Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,13 @@ pytesseract.pytesseract.tesseract_cmd = '/usr/bin/tesseract'
|
|
| 17 |
|
| 18 |
# Load your YOLO model
|
| 19 |
model = YOLO('best.pt') # Replace with your custom model if needed
|
|
|
|
| 20 |
|
| 21 |
def predict(image, conf_threshold, iou_threshold):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Convert from PIL to OpenCV format
|
| 23 |
image = np.array(image)
|
| 24 |
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
|
|
|
| 17 |
|
| 18 |
# Load your YOLO model
|
| 19 |
model = YOLO('best.pt') # Replace with your custom model if needed
|
| 20 |
+
img_dim = (640, 640)
|
| 21 |
|
| 22 |
def predict(image, conf_threshold, iou_threshold):
|
| 23 |
+
|
| 24 |
+
# Resizing
|
| 25 |
+
image = image.resize(img_dim)
|
| 26 |
+
|
| 27 |
# Convert from PIL to OpenCV format
|
| 28 |
image = np.array(image)
|
| 29 |
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|