Spaces:
Runtime error
Runtime error
Commit
·
709f5ad
1
Parent(s):
84b3093
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
from transformers import DetrFeatureExtractor, DetrForObjectDetection
|
|
|
|
| 2 |
from PIL import Image, ImageDraw, ImageFont
|
| 3 |
import requests
|
| 4 |
import gradio as gr
|
|
@@ -9,7 +10,7 @@ def draw_bounding_box(im, score, label, xmin, ymin, xmax, ymax, index, num_boxes
|
|
| 9 |
# Draw the actual bounding box
|
| 10 |
outline = 'blue'
|
| 11 |
im_with_rectangle = ImageDraw.Draw(im)
|
| 12 |
-
im_with_rectangle.rounded_rectangle((xmin, ymin, xmax, ymax), outline = outline, width =
|
| 13 |
|
| 14 |
# Return the result
|
| 15 |
return im
|
|
@@ -35,7 +36,7 @@ def object_classify(img):
|
|
| 35 |
box['xmin'], box['ymin'],
|
| 36 |
box['xmax'], box['ymax'],
|
| 37 |
index, num_boxes)
|
| 38 |
-
|
| 39 |
return output_image
|
| 40 |
|
| 41 |
|
|
|
|
| 1 |
+
from transformers import DetrFeatureExtractor, DetrForObjectDetection,
|
| 2 |
+
from transformers import pipeline
|
| 3 |
from PIL import Image, ImageDraw, ImageFont
|
| 4 |
import requests
|
| 5 |
import gradio as gr
|
|
|
|
| 10 |
# Draw the actual bounding box
|
| 11 |
outline = 'blue'
|
| 12 |
im_with_rectangle = ImageDraw.Draw(im)
|
| 13 |
+
im_with_rectangle.rounded_rectangle((xmin, ymin, xmax, ymax), outline = outline, width = 2, radius = 7)
|
| 14 |
|
| 15 |
# Return the result
|
| 16 |
return im
|
|
|
|
| 36 |
box['xmin'], box['ymin'],
|
| 37 |
box['xmax'], box['ymax'],
|
| 38 |
index, num_boxes)
|
| 39 |
+
index += 1
|
| 40 |
return output_image
|
| 41 |
|
| 42 |
|