Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,6 @@ model = AutoModelForObjectDetection.from_pretrained('hustvl/yolos-small')
|
|
9 |
def detect(image):
|
10 |
inputs = image_processor(images=image, return_tensors="pt")
|
11 |
outputs = model(**inputs)
|
12 |
-
image = Image.open(image)
|
13 |
|
14 |
# convert outputs to COCO API
|
15 |
target_sizes = torch.tensor([image.size[::-1]])
|
@@ -28,7 +27,7 @@ def detect(image):
|
|
28 |
|
29 |
demo = gr.Interface(
|
30 |
fn=detect,
|
31 |
-
inputs=[gr.inputs.Image(label="Input image")],
|
32 |
outputs=["text"], #, gr.Label(num_top_classes=10)],
|
33 |
title="Object Counts in Image"
|
34 |
)
|
|
|
9 |
def detect(image):
|
10 |
inputs = image_processor(images=image, return_tensors="pt")
|
11 |
outputs = model(**inputs)
|
|
|
12 |
|
13 |
# convert outputs to COCO API
|
14 |
target_sizes = torch.tensor([image.size[::-1]])
|
|
|
27 |
|
28 |
demo = gr.Interface(
|
29 |
fn=detect,
|
30 |
+
inputs=[gr.inputs.Image(label="Input image", type="pil")],
|
31 |
outputs=["text"], #, gr.Label(num_top_classes=10)],
|
32 |
title="Object Counts in Image"
|
33 |
)
|