jeffaudi commited on
Commit
5f3c1c1
·
1 Parent(s): f7dba65

Fix display

Browse files
Files changed (2) hide show
  1. .gitignore +2 -1
  2. app.py +4 -3
.gitignore CHANGED
@@ -1 +1,2 @@
1
- **/.DS_Store
 
 
1
+ **/.DS_Store
2
+ gradio_cached_examples
app.py CHANGED
@@ -61,13 +61,14 @@ def predict_image(image, threshold):
61
  # drow boxes on image
62
  draw = ImageDraw.Draw(image)
63
 
64
- for (class_name, coords, confidence) in detections:
 
65
  if len(coords) != 4:
66
- raise ValueError("Each detection should be a polygon with 8 coordinates (xyxyxyxy).")
67
 
68
  points = [(coord[0], coord[1]) for coord in coords]
69
  draw.polygon(points, outline="red", width=LINE_WIDTH)
70
- draw.text((points[0][0], points[0][1]), class_name, fill="red")
71
 
72
  return image, img.shape, len(detections), duration
73
 
 
61
  # drow boxes on image
62
  draw = ImageDraw.Draw(image)
63
 
64
+ for detection in detections:
65
+ coords = detection['xyxyxyxy']
66
  if len(coords) != 4:
67
+ raise ValueError("Each detection should be a polygon with 4 coordinates (xyxyxyxy).")
68
 
69
  points = [(coord[0], coord[1]) for coord in coords]
70
  draw.polygon(points, outline="red", width=LINE_WIDTH)
71
+ draw.text((points[0][0], points[0][1]), detection['class_name'], fill="red")
72
 
73
  return image, img.shape, len(detections), duration
74