Spaces:
Sleeping
Sleeping
bugfix yolo
Browse files
app.py
CHANGED
|
@@ -24,11 +24,12 @@ yolo_model = YOLO(yolo_model_dir)
|
|
| 24 |
|
| 25 |
|
| 26 |
def predicted_diagnosis(img):
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
|
| 33 |
crop_result = yolo_model(padded_image)[0]
|
| 34 |
boxes = crop_result.boxes.xyxy
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def predicted_diagnosis(img):
|
|
|
|
| 27 |
|
| 28 |
+
target_size = (640, 640)
|
| 29 |
|
| 30 |
+
img.thumbnail(target_size, Image.LANCZOS)
|
| 31 |
+
|
| 32 |
+
padded_image = ImageOps.pad(img, target_size, color=fill_color)
|
| 33 |
|
| 34 |
crop_result = yolo_model(padded_image)[0]
|
| 35 |
boxes = crop_result.boxes.xyxy
|