Spaces:
Runtime error
Runtime error
valentynliubchenko commited on
Commit ·
6729627
1
Parent(s): 966e13f
Fixed RGB
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ def process_image(input_image, model_name, conf):
|
|
| 16 |
if input_image is None:
|
| 17 |
return None, "No objects detected."
|
| 18 |
|
|
|
|
| 19 |
print(f"model_name : {model_name}")
|
| 20 |
print(f"conf : {conf}")
|
| 21 |
|
|
@@ -37,6 +38,7 @@ def process_image(input_image, model_name, conf):
|
|
| 37 |
for r in results:
|
| 38 |
im_array = r.plot()
|
| 39 |
im_array = im_array.astype(np.uint8)
|
|
|
|
| 40 |
|
| 41 |
if len(r.boxes) == 0: # If no objects are detected
|
| 42 |
return None, "No objects detected."
|
|
|
|
| 16 |
if input_image is None:
|
| 17 |
return None, "No objects detected."
|
| 18 |
|
| 19 |
+
input_image = cv2.cvtColor(input_image, cv2.COLOR_RGB2BGR)
|
| 20 |
print(f"model_name : {model_name}")
|
| 21 |
print(f"conf : {conf}")
|
| 22 |
|
|
|
|
| 38 |
for r in results:
|
| 39 |
im_array = r.plot()
|
| 40 |
im_array = im_array.astype(np.uint8)
|
| 41 |
+
im_array = cv2.cvtColor(im_array, cv2.COLOR_BGR2RGB)
|
| 42 |
|
| 43 |
if len(r.boxes) == 0: # If no objects are detected
|
| 44 |
return None, "No objects detected."
|