Spaces:
Runtime error
Runtime error
nehulagrawal
commited on
Commit
Β·
8b4c535
1
Parent(s):
d5c8e5b
Update app.py
Browse files
app.py
CHANGED
@@ -1,57 +1,45 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
|
|
3 |
import cv2
|
4 |
import requests
|
5 |
import os
|
6 |
-
|
7 |
from ultralyticsplus import YOLO, render_result
|
8 |
|
9 |
# Model Heading and Description
|
10 |
model_heading = "StockMarket: Trends Recognition for Trading Success"
|
11 |
-
description = "
|
12 |
-
Dive deep into the enigma of market trends with the precision of a seasoned detective. π΅οΈββοΈ With Foduu AI's unparalleled insights, transition seamlessly from bearish 'Downs' to bullish 'Ups'. ππ
|
13 |
-
Consider us your trading compass, guiding you through the financial wilderness like a modern-day Gandalf. π§ββοΈ Whether you're a seasoned trader or just embarking on your journey, we're here to illuminate your path. π‘
|
14 |
-
Trading with us? It's like possessing the secret recipe to investment success. π²π°
|
15 |
-
Intrigued? Dive into the world of trading alchemy! π
|
16 |
-
π Reach Out: [email protected]
|
17 |
-
π Give us a thumbs up and embark on an unparalleled trading escapade! No, you won't gain superpowers, but you'll be one step closer to mastering the markets! πππ!"""
|
18 |
|
19 |
-
image_path= [['test/1.jpg', 'foduucom/stockmarket-future-prediction', 640, 0.25, 0.45],
|
20 |
|
21 |
# Load YOLO model
|
22 |
model = YOLO("foduucom/stockmarket-future-prediction")
|
23 |
|
24 |
-
|
25 |
-
#############################################################Image Inference############################################################
|
26 |
def yolov8_img_inference(
|
27 |
-
image:
|
28 |
-
model_path:
|
29 |
-
image_size:
|
30 |
-
conf_threshold:
|
31 |
-
iou_threshold:
|
32 |
):
|
33 |
model = YOLO(model_path)
|
34 |
model.overrides['conf'] = conf_threshold
|
35 |
-
model.overrides['iou']= iou_threshold
|
36 |
-
model.overrides['agnostic_nms'] = False
|
37 |
-
model.overrides['max_det'] = 1000
|
38 |
-
#image = read_image(image)
|
39 |
results = model.predict(image)
|
40 |
render = render_result(model=model, image=image, result=results[0])
|
41 |
-
|
42 |
return render
|
43 |
|
44 |
-
|
45 |
inputs_image = [
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
|
52 |
]
|
53 |
|
54 |
-
outputs_image =
|
|
|
55 |
interface_image = gr.Interface(
|
56 |
fn=yolov8_img_inference,
|
57 |
inputs=inputs_image,
|
@@ -62,5 +50,6 @@ interface_image = gr.Interface(
|
|
62 |
cache_examples=False,
|
63 |
theme='huggingface'
|
64 |
)
|
|
|
65 |
interface_image.queue()
|
66 |
-
interface_image.launch(debug=True)
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio import components as gc
|
3 |
import cv2
|
4 |
import requests
|
5 |
import os
|
|
|
6 |
from ultralyticsplus import YOLO, render_result
|
7 |
|
8 |
# Model Heading and Description
|
9 |
model_heading = "StockMarket: Trends Recognition for Trading Success"
|
10 |
+
description = "... (rest of the description) ..."
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
image_path = [['test/1.jpg', 'foduucom/stockmarket-future-prediction', 640, 0.25, 0.45], ...]
|
13 |
|
14 |
# Load YOLO model
|
15 |
model = YOLO("foduucom/stockmarket-future-prediction")
|
16 |
|
|
|
|
|
17 |
def yolov8_img_inference(
|
18 |
+
image: gc.Image = None,
|
19 |
+
model_path: str = "foduucom/stockmarket-future-prediction",
|
20 |
+
image_size: gc.Slider = 640,
|
21 |
+
conf_threshold: gc.Slider = 0.25,
|
22 |
+
iou_threshold: gc.Slider = 0.45
|
23 |
):
|
24 |
model = YOLO(model_path)
|
25 |
model.overrides['conf'] = conf_threshold
|
26 |
+
model.overrides['iou'] = iou_threshold
|
27 |
+
model.overrides['agnostic_nms'] = False
|
28 |
+
model.overrides['max_det'] = 1000
|
|
|
29 |
results = model.predict(image)
|
30 |
render = render_result(model=model, image=image, result=results[0])
|
|
|
31 |
return render
|
32 |
|
|
|
33 |
inputs_image = [
|
34 |
+
gc.Image(type="filepath", label="Input Image"),
|
35 |
+
gc.Dropdown(["foduucom/stockmarket-future-prediction"], default="foduucom/stockmarket-future-prediction", label="Model"),
|
36 |
+
gc.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
|
37 |
+
gc.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
|
38 |
+
gc.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
|
|
|
39 |
]
|
40 |
|
41 |
+
outputs_image = gc.Image(type="filepath", label="Output Image")
|
42 |
+
|
43 |
interface_image = gr.Interface(
|
44 |
fn=yolov8_img_inference,
|
45 |
inputs=inputs_image,
|
|
|
50 |
cache_examples=False,
|
51 |
theme='huggingface'
|
52 |
)
|
53 |
+
|
54 |
interface_image.queue()
|
55 |
+
interface_image.launch(debug=True)
|