Spaces:
Runtime error
Runtime error
nehulagrawal
commited on
Commit
•
13fd314
1
Parent(s):
bd7ded1
Update app.py
Browse files
app.py
CHANGED
@@ -23,21 +23,29 @@ model = YOLO('foduucom/stockmarket-future-prediction')
|
|
23 |
|
24 |
#############################################################Image Inference############################################################
|
25 |
def yolov8_img_inference(
|
26 |
-
image: gr.
|
27 |
-
model_path:
|
28 |
-
image_size: gr.
|
29 |
-
conf_threshold: gr.
|
30 |
-
iou_threshold: gr.
|
31 |
):
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
model = YOLO(model_path)
|
37 |
model.overrides['conf'] = conf_threshold
|
38 |
-
model.overrides['iou']
|
39 |
model.overrides['agnostic_nms'] = False # NMS class-agnostic
|
40 |
model.overrides['max_det'] = 1000
|
|
|
41 |
results = model.predict(image)
|
42 |
render = render_result(model=model, image=image, result=results[0])
|
43 |
|
|
|
23 |
|
24 |
#############################################################Image Inference############################################################
|
25 |
def yolov8_img_inference(
|
26 |
+
image: gr.inputs.Image = None,
|
27 |
+
model_path: gr.inputs.Dropdown = None,
|
28 |
+
image_size: gr.inputs.Slider = 640,
|
29 |
+
conf_threshold: gr.inputs.Slider = 0.25,
|
30 |
+
iou_threshold: gr.inputs.Slider = 0.45,
|
31 |
):
|
32 |
+
"""
|
33 |
+
YOLOv8 inference function
|
34 |
+
Args:
|
35 |
+
image: Input image
|
36 |
+
model_path: Path to the model
|
37 |
+
image_size: Image size
|
38 |
+
conf_threshold: Confidence threshold
|
39 |
+
iou_threshold: IOU threshold
|
40 |
+
Returns:
|
41 |
+
Rendered image
|
42 |
+
"""
|
43 |
model = YOLO(model_path)
|
44 |
model.overrides['conf'] = conf_threshold
|
45 |
+
model.overrides['iou']= iou_threshold
|
46 |
model.overrides['agnostic_nms'] = False # NMS class-agnostic
|
47 |
model.overrides['max_det'] = 1000
|
48 |
+
# image = read_image(image)
|
49 |
results = model.predict(image)
|
50 |
render = render_result(model=model, image=image, result=results[0])
|
51 |
|