Spaces:
Sleeping
Sleeping
Update app examples
Browse files
app.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
from yolo import YOLO
|
|
@@ -14,15 +16,7 @@ def predict(image):
|
|
| 14 |
|
| 15 |
title = "RDFNet: Real-time Object Detection Framework for Foggy Scenes"
|
| 16 |
|
| 17 |
-
example_images =
|
| 18 |
-
"img/1.png",
|
| 19 |
-
"img/2.png",
|
| 20 |
-
"img/3.png",
|
| 21 |
-
"img/4.png",
|
| 22 |
-
"img/5.png",
|
| 23 |
-
"img/6.png",
|
| 24 |
-
"img/7.png",
|
| 25 |
-
]
|
| 26 |
|
| 27 |
|
| 28 |
with gr.Blocks() as demo:
|
|
@@ -36,7 +30,8 @@ with gr.Blocks() as demo:
|
|
| 36 |
output = gr.Image(type="pil", label="Prediction Result")
|
| 37 |
|
| 38 |
submit_btn.click(fn=predict, inputs=img_input, outputs=output)
|
| 39 |
-
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
from yolo import YOLO
|
|
|
|
| 16 |
|
| 17 |
title = "RDFNet: Real-time Object Detection Framework for Foggy Scenes"
|
| 18 |
|
| 19 |
+
example_images = sorted(str(path) for path in Path("img").glob("*") if path.is_file())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
with gr.Blocks() as demo:
|
|
|
|
| 30 |
output = gr.Image(type="pil", label="Prediction Result")
|
| 31 |
|
| 32 |
submit_btn.click(fn=predict, inputs=img_input, outputs=output)
|
| 33 |
+
if example_images:
|
| 34 |
+
gr.Examples(examples=example_images, inputs=img_input)
|
| 35 |
|
| 36 |
|
| 37 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|