Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ def get_figure(in_pil_img, in_results):
|
|
| 43 |
w, h = prediction['box']['xmax'] - prediction['box']['xmin'], prediction['box']['ymax'] - prediction['box']['ymin']
|
| 44 |
|
| 45 |
ax.add_patch(plt.Rectangle((x, y), w, h, fill=False, color=selected_color, linewidth=3))
|
| 46 |
-
ax.text(x, y, f"{prediction['label']}: {round(prediction['score']*100, 1)}%", fontdict=fdic)
|
| 47 |
|
| 48 |
plt.axis("off")
|
| 49 |
|
|
@@ -81,23 +81,23 @@ with gr.Blocks(title="Object Detection",
|
|
| 81 |
# model = gr.Radio(["detr-resnet-50", "detr-resnet-101"], value="detr-resnet-50", label="Model name")
|
| 82 |
|
| 83 |
# gr.HTML("""<br/>""")
|
| 84 |
-
gr.HTML("""<h4>Select an example by clicking a thumbnail below.</h4>""")
|
| 85 |
-
gr.HTML("""<h4>Or upload an image by clicking on the canvas.</h4>""")
|
| 86 |
|
| 87 |
with gr.Row():
|
| 88 |
input_image = gr.Image(label="Input image", type="pil")
|
| 89 |
-
output_image = gr.Image(label="Output image with
|
| 90 |
|
| 91 |
gr.Examples(['samples/cats.jpg', 'samples/detectron2.png', 'samples/cat.jpg', 'samples/hotdog.jpg'], inputs=input_image)
|
| 92 |
|
| 93 |
# gr.HTML("""<br/>""")
|
| 94 |
-
gr.HTML("""<h4>Click "Infer" button to predict object instances. It will take about 10 seconds
|
| 95 |
|
| 96 |
send_btn = gr.Button("Infer")
|
| 97 |
send_btn.click(fn=infer, inputs=[input_image], outputs=[output_image])
|
| 98 |
|
| 99 |
#demo.queue()
|
| 100 |
-
demo.launch(
|
| 101 |
|
| 102 |
|
| 103 |
### EOF ###
|
|
|
|
| 43 |
w, h = prediction['box']['xmax'] - prediction['box']['xmin'], prediction['box']['ymax'] - prediction['box']['ymin']
|
| 44 |
|
| 45 |
ax.add_patch(plt.Rectangle((x, y), w, h, fill=False, color=selected_color, linewidth=3))
|
| 46 |
+
# ax.text(x, y, f"{prediction['label']}: {round(prediction['score']*100, 1)}%", fontdict=fdic)
|
| 47 |
|
| 48 |
plt.axis("off")
|
| 49 |
|
|
|
|
| 81 |
# model = gr.Radio(["detr-resnet-50", "detr-resnet-101"], value="detr-resnet-50", label="Model name")
|
| 82 |
|
| 83 |
# gr.HTML("""<br/>""")
|
| 84 |
+
# gr.HTML("""<h4>Select an example by clicking a thumbnail below.</h4>""")
|
| 85 |
+
# gr.HTML("""<h4>Or upload an image by clicking on the canvas.</h4>""")
|
| 86 |
|
| 87 |
with gr.Row():
|
| 88 |
input_image = gr.Image(label="Input image", type="pil")
|
| 89 |
+
output_image = gr.Image(label="Output image with object detection", type="pil")
|
| 90 |
|
| 91 |
gr.Examples(['samples/cats.jpg', 'samples/detectron2.png', 'samples/cat.jpg', 'samples/hotdog.jpg'], inputs=input_image)
|
| 92 |
|
| 93 |
# gr.HTML("""<br/>""")
|
| 94 |
+
gr.HTML("""<h4>Click "Infer" button to predict object instances. It will take about 10-15 seconds</h4>""")
|
| 95 |
|
| 96 |
send_btn = gr.Button("Infer")
|
| 97 |
send_btn.click(fn=infer, inputs=[input_image], outputs=[output_image])
|
| 98 |
|
| 99 |
#demo.queue()
|
| 100 |
+
demo.launch()
|
| 101 |
|
| 102 |
|
| 103 |
### EOF ###
|