Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -52,8 +52,8 @@ def visualize_prediction(img, output_dict, threshold=0.5, id2label=None):
|
|
52 |
ax = plt.gca()
|
53 |
colors = COLORS * 100
|
54 |
for score, (xmin, ymin, xmax, ymax), label, color in zip(scores, boxes, labels, colors):
|
55 |
-
ax.add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, fill=False, color=color, linewidth=
|
56 |
-
ax.text(xmin, ymin, f"{label}: {score:0.2f}", fontsize=
|
57 |
plt.axis("off")
|
58 |
return fig2img(plt.gcf())
|
59 |
|
@@ -137,6 +137,7 @@ with demo:
|
|
137 |
with gr.Column():
|
138 |
url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
|
139 |
original_image = gr.Image(shape=(750,750))
|
|
|
140 |
with gr.Column():
|
141 |
img_output_from_url = gr.Image(shape=(750,750))
|
142 |
|
|
|
52 |
ax = plt.gca()
|
53 |
colors = COLORS * 100
|
54 |
for score, (xmin, ymin, xmax, ymax), label, color in zip(scores, boxes, labels, colors):
|
55 |
+
ax.add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, fill=False, color=color, linewidth=5))
|
56 |
+
ax.text(xmin, ymin, f"{label}: {score:0.2f}", fontsize=25, bbox=dict(facecolor="yellow", alpha=0.5))
|
57 |
plt.axis("off")
|
58 |
return fig2img(plt.gcf())
|
59 |
|
|
|
137 |
with gr.Column():
|
138 |
url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
|
139 |
original_image = gr.Image(shape=(750,750))
|
140 |
+
url_input.submit(get_original_image,url_input,original_image)
|
141 |
with gr.Column():
|
142 |
img_output_from_url = gr.Image(shape=(750,750))
|
143 |
|