Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,26 +81,19 @@ def run_detection(image_path):
|
|
| 81 |
return to_pil_image(result_image_tensor)
|
| 82 |
|
| 83 |
|
| 84 |
-
|
| 85 |
-
fn=run_detection,
|
| 86 |
-
inputs=gr.Image(
|
| 87 |
-
type="filepath",
|
| 88 |
-
label="Upload Image"
|
| 89 |
-
),
|
| 90 |
-
outputs=gr.Image(
|
| 91 |
-
type="pil",
|
| 92 |
-
label="Output Image"
|
| 93 |
-
),
|
| 94 |
-
title="<br>This app uses:<br>PyTorch Vision. <br>PyTorch Model: ResNet50_FPN",
|
| 95 |
-
|
| 96 |
-
description="""
|
| 97 |
-
The model is adjusted to only detect **car** and **traffic light**.
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
|
|
|
|
| 81 |
return to_pil_image(result_image_tensor)
|
| 82 |
|
| 83 |
|
| 84 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
iface = gr.Interface(
|
| 87 |
+
fn=run_detection,
|
| 88 |
+
inputs=gr.Image(type="filepath", label="Upload Image"),
|
| 89 |
+
outputs=gr.Image(type="pil", label="Output Image"),
|
| 90 |
+
title="<br>This app uses:<br>PyTorch Vision. <br>PyTorch Model: FasterRCNN_ResNet50_FPN"
|
| 91 |
+
)
|
| 92 |
+
gr.Markdown("### The model is adjusted to only detect car and traffic light. Example output:")
|
| 93 |
+
gr.Image(
|
| 94 |
+
value="exap1.JPG",
|
| 95 |
+
show_label=False,
|
| 96 |
+
width=450
|
| 97 |
+
)
|
| 98 |
|
| 99 |
+
demo.launch()
|