Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
3 |
from PIL import Image, ImageDraw
|
4 |
import torch
|
@@ -31,8 +32,13 @@ def detect(image):
|
|
31 |
x1, y1, x2, y2 = tuple(box)
|
32 |
draw.rectangle((x1, y1, x2, y2), outline="red", width=2)
|
33 |
draw.text((x1, y1), label_name, fill="white")
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
return image,
|
36 |
|
37 |
demo = gr.Interface(
|
38 |
fn=detect,
|
|
|
1 |
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
4 |
from PIL import Image, ImageDraw
|
5 |
import torch
|
|
|
32 |
x1, y1, x2, y2 = tuple(box)
|
33 |
draw.rectangle((x1, y1, x2, y2), outline="red", width=2)
|
34 |
draw.text((x1, y1), label_name, fill="white")
|
35 |
+
|
36 |
+
df = pd.DataFrame({
|
37 |
+
'label': [label for label in counts],
|
38 |
+
'counts': [counts[label] for label in counts]
|
39 |
+
})
|
40 |
|
41 |
+
return image, df, counts
|
42 |
|
43 |
demo = gr.Interface(
|
44 |
fn=detect,
|