Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -31,10 +31,10 @@ def yolo_inference(image, model_id, conf_threshold, iou_threshold):
|
|
31 |
return annotated_image
|
32 |
|
33 |
def app():
|
34 |
-
with gr.Blocks():
|
35 |
with gr.Row():
|
36 |
with gr.Column():
|
37 |
-
image = gr.Image(type="pil", label="Image"
|
38 |
|
39 |
model_id = gr.Dropdown(
|
40 |
label="Model",
|
@@ -60,12 +60,12 @@ def app():
|
|
60 |
step=0.1,
|
61 |
value=0.45,
|
62 |
)
|
63 |
-
|
64 |
|
65 |
with gr.Column():
|
66 |
-
output_image = gr.Image(type="pil", label="Annotated Image"
|
67 |
|
68 |
-
|
69 |
fn=yolo_inference,
|
70 |
inputs=[
|
71 |
image,
|
@@ -79,7 +79,7 @@ def app():
|
|
79 |
gr.Examples(
|
80 |
examples=[
|
81 |
[
|
82 |
-
"
|
83 |
"yolov10x.pt",
|
84 |
0.25,
|
85 |
0.45,
|
@@ -102,10 +102,6 @@ def app():
|
|
102 |
cache_examples="lazy",
|
103 |
)
|
104 |
|
105 |
-
|
106 |
-
with gradio_app:
|
107 |
-
with gr.Row():
|
108 |
-
with gr.Column():
|
109 |
-
app()
|
110 |
|
111 |
-
|
|
|
31 |
return annotated_image
|
32 |
|
33 |
def app():
|
34 |
+
with gr.Blocks() as demo:
|
35 |
with gr.Row():
|
36 |
with gr.Column():
|
37 |
+
image = gr.Image(type="pil", label="Image")
|
38 |
|
39 |
model_id = gr.Dropdown(
|
40 |
label="Model",
|
|
|
60 |
step=0.1,
|
61 |
value=0.45,
|
62 |
)
|
63 |
+
yolo_infer = gr.Button(value="Detect Objects")
|
64 |
|
65 |
with gr.Column():
|
66 |
+
output_image = gr.Image(type="pil", label="Annotated Image")
|
67 |
|
68 |
+
yolo_infer.click(
|
69 |
fn=yolo_inference,
|
70 |
inputs=[
|
71 |
image,
|
|
|
79 |
gr.Examples(
|
80 |
examples=[
|
81 |
[
|
82 |
+
"a.jpg",
|
83 |
"yolov10x.pt",
|
84 |
0.25,
|
85 |
0.45,
|
|
|
102 |
cache_examples="lazy",
|
103 |
)
|
104 |
|
105 |
+
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
app()
|