Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ def render_box(image, results):
|
|
| 52 |
|
| 53 |
rect = patches.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, linewidth=2, edgecolor=color, facecolor='none')
|
| 54 |
ax.add_patch(rect)
|
| 55 |
-
plt.text(xmin, ymin, f"{
|
| 56 |
|
| 57 |
plt.axis('off')
|
| 58 |
st.pyplot(plt)
|
|
@@ -72,3 +72,4 @@ else:
|
|
| 72 |
image = Image.open(BytesIO(response.content))
|
| 73 |
results = detect(image)
|
| 74 |
render_box(image, results)
|
|
|
|
|
|
| 52 |
|
| 53 |
rect = patches.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, linewidth=2, edgecolor=color, facecolor='none')
|
| 54 |
ax.add_patch(rect)
|
| 55 |
+
plt.text(xmin, ymin, f"{model.config.id2label[label.item()]}: {score:.2f}", color=color, fontsize=12, bbox=dict(facecolor='white', alpha=0.5))
|
| 56 |
|
| 57 |
plt.axis('off')
|
| 58 |
st.pyplot(plt)
|
|
|
|
| 72 |
image = Image.open(BytesIO(response.content))
|
| 73 |
results = detect(image)
|
| 74 |
render_box(image, results)
|
| 75 |
+
|