Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -53,8 +53,8 @@ def visualize_prediction(img, output_dict, threshold=0.5, id2label=None):
|
|
53 |
ax = plt.gca()
|
54 |
colors = COLORS * 100
|
55 |
for score, (xmin, ymin, xmax, ymax), label, color in zip(scores, boxes, labels, colors):
|
56 |
-
ax.add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, fill=False, color=color, linewidth=
|
57 |
-
ax.text(xmin, ymin, f"{label}: {score:0.2f}", fontsize=
|
58 |
plt.axis("off")
|
59 |
return fig2img(plt.gcf())
|
60 |
|
@@ -127,7 +127,7 @@ with demo:
|
|
127 |
gr.Markdown(title)
|
128 |
gr.Markdown(description)
|
129 |
gr.Markdown(twitter_link)
|
130 |
-
options = gr.Dropdown(choices=models,label='Object Detection Model',show_label=True)
|
131 |
slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.5,step=0.1,label='Prediction Threshold')
|
132 |
|
133 |
with gr.Tabs():
|
|
|
53 |
ax = plt.gca()
|
54 |
colors = COLORS * 100
|
55 |
for score, (xmin, ymin, xmax, ymax), label, color in zip(scores, boxes, labels, colors):
|
56 |
+
ax.add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, fill=False, color=color, linewidth=8))
|
57 |
+
ax.text(xmin, ymin, f"{label}: {score:0.2f}", fontsize=40, bbox=dict(facecolor="yellow", alpha=0.5))
|
58 |
plt.axis("off")
|
59 |
return fig2img(plt.gcf())
|
60 |
|
|
|
127 |
gr.Markdown(title)
|
128 |
gr.Markdown(description)
|
129 |
gr.Markdown(twitter_link)
|
130 |
+
options = gr.Dropdown(choices=models,label='Object Detection Model',value=models[0],show_label=True)
|
131 |
slider_input = gr.Slider(minimum=0.2,maximum=1,value=0.5,step=0.1,label='Prediction Threshold')
|
132 |
|
133 |
with gr.Tabs():
|