Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import yolov7
|
| 3 |
import subprocess
|
| 4 |
import tempfile
|
|
@@ -11,11 +11,11 @@ import gradio as gr
|
|
| 11 |
|
| 12 |
|
| 13 |
def image_fn(
|
| 14 |
-
image: gr.Image = None,
|
| 15 |
-
model_path: gr.Dropdown = None,
|
| 16 |
-
image_size: gr.Slider = 640,
|
| 17 |
-
conf_threshold: gr.Slider = 0.25,
|
| 18 |
-
iou_threshold: gr.Slider = 0.45,
|
| 19 |
):
|
| 20 |
"""
|
| 21 |
YOLOv7 inference function
|
|
@@ -41,8 +41,8 @@ def image_fn(
|
|
| 41 |
image_interface = gr.Interface(
|
| 42 |
fn=image_fn,
|
| 43 |
inputs=[
|
| 44 |
-
gr.Image(type="
|
| 45 |
-
gr.Dropdown(
|
| 46 |
choices=[
|
| 47 |
"Aalaa/Yolov7_Visual_Pollution_Detection",
|
| 48 |
],
|
|
@@ -53,7 +53,7 @@ image_interface = gr.Interface(
|
|
| 53 |
#gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
|
| 54 |
#gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold")
|
| 55 |
],
|
| 56 |
-
outputs=gr.Image(type="filepath", label="Output Image"),
|
| 57 |
|
| 58 |
examples=[['image1.jpg', 'Aalaa/Yolov7_Visual_Pollution_Detection', 640, 0.25, 0.45]],
|
| 59 |
cache_examples=True,
|
|
|
|
| 1 |
+
:import gradio as gr
|
| 2 |
import yolov7
|
| 3 |
import subprocess
|
| 4 |
import tempfile
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
def image_fn(
|
| 14 |
+
image: gr.inputs.Image = None,
|
| 15 |
+
model_path: gr.inputs.Dropdown = None,
|
| 16 |
+
image_size: gr.inputs.Slider = 640,
|
| 17 |
+
conf_threshold: gr.inputs.Slider = 0.25,
|
| 18 |
+
iou_threshold: gr.inputs.Slider = 0.45,
|
| 19 |
):
|
| 20 |
"""
|
| 21 |
YOLOv7 inference function
|
|
|
|
| 41 |
image_interface = gr.Interface(
|
| 42 |
fn=image_fn,
|
| 43 |
inputs=[
|
| 44 |
+
gr.inputs.Image(type="pil", label="Input Image"),
|
| 45 |
+
gr.inputs.Dropdown(
|
| 46 |
choices=[
|
| 47 |
"Aalaa/Yolov7_Visual_Pollution_Detection",
|
| 48 |
],
|
|
|
|
| 53 |
#gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
|
| 54 |
#gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold")
|
| 55 |
],
|
| 56 |
+
outputs=gr.outputs.Image(type="filepath", label="Output Image"),
|
| 57 |
|
| 58 |
examples=[['image1.jpg', 'Aalaa/Yolov7_Visual_Pollution_Detection', 640, 0.25, 0.45]],
|
| 59 |
cache_examples=True,
|