Spaces:
Build error
Build error
Ihor Bilyk commited on
Commit ·
484ca79
1
Parent(s): 566a28f
minor
Browse files
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
from sahi.prediction import ObjectPrediction
|
| 4 |
from sahi.utils.cv import visualize_object_predictions, read_image
|
| 5 |
from ultralyticsplus import YOLO
|
| 6 |
|
| 7 |
# Images
|
| 8 |
-
torch.hub.download_url_to_file('https://raw.githubusercontent.com/kadirnar/dethub/main/data/images/highway.jpg', 'highway.jpg')
|
| 9 |
-
torch.hub.download_url_to_file('https://user-images.githubusercontent.com/34196005/142742872-1fefcc4d-d7e6-4c43-bbb7-6b5982f7e4ba.jpg', 'highway1.jpg')
|
| 10 |
-
torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
|
| 11 |
|
| 12 |
def yolov8_inference(
|
| 13 |
image: gr.inputs.Image = None,
|
|
@@ -61,15 +61,15 @@ def yolov8_inference(
|
|
| 61 |
|
| 62 |
inputs = [
|
| 63 |
gr.inputs.Image(type="filepath", label="Input Image"),
|
| 64 |
-
gr.inputs.Dropdown(["
|
| 65 |
-
default="
|
| 66 |
gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
|
| 67 |
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
|
| 68 |
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
|
| 69 |
]
|
| 70 |
|
| 71 |
outputs = gr.outputs.Image(type="filepath", label="Output Image")
|
| 72 |
-
title = "Ultralytics YOLOv8:
|
| 73 |
|
| 74 |
demo_app = gr.Interface(
|
| 75 |
fn=yolov8_inference,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
#import torch
|
| 3 |
from sahi.prediction import ObjectPrediction
|
| 4 |
from sahi.utils.cv import visualize_object_predictions, read_image
|
| 5 |
from ultralyticsplus import YOLO
|
| 6 |
|
| 7 |
# Images
|
| 8 |
+
# torch.hub.download_url_to_file('https://raw.githubusercontent.com/kadirnar/dethub/main/data/images/highway.jpg', 'highway.jpg')
|
| 9 |
+
# torch.hub.download_url_to_file('https://user-images.githubusercontent.com/34196005/142742872-1fefcc4d-d7e6-4c43-bbb7-6b5982f7e4ba.jpg', 'highway1.jpg')
|
| 10 |
+
# torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
|
| 11 |
|
| 12 |
def yolov8_inference(
|
| 13 |
image: gr.inputs.Image = None,
|
|
|
|
| 61 |
|
| 62 |
inputs = [
|
| 63 |
gr.inputs.Image(type="filepath", label="Input Image"),
|
| 64 |
+
gr.inputs.Dropdown(["ihorbilyk/yolov8c-v1.0"],
|
| 65 |
+
default="ihorbilyk/yolov8c-v1.0", label="Model"),
|
| 66 |
gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
|
| 67 |
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
|
| 68 |
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
|
| 69 |
]
|
| 70 |
|
| 71 |
outputs = gr.outputs.Image(type="filepath", label="Output Image")
|
| 72 |
+
title = "Ultralytics YOLOv8: Fine-tuned for checks detection"
|
| 73 |
|
| 74 |
demo_app = gr.Interface(
|
| 75 |
fn=yolov8_inference,
|