Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def detect_fruit(image):
|
|
25 |
|
26 |
# проверка на наличие детекций
|
27 |
if len(detections) == 0:
|
28 |
-
return
|
29 |
|
30 |
result_np_image = detections[0].plot()
|
31 |
result_np_image = cv2.cvtColor(result_np_image, cv2.COLOR_BGR2RGB)
|
@@ -69,9 +69,9 @@ def gradio_interface(image, weight):
|
|
69 |
return None, None
|
70 |
|
71 |
result_np_image, detected_fruit = detect_fruit(image)
|
72 |
-
if
|
73 |
gr.Info('Не удалось определить товар')
|
74 |
-
return
|
75 |
|
76 |
receipt = create_receipt(detected_fruit, weight)
|
77 |
return result_np_image, receipt
|
|
|
25 |
|
26 |
# проверка на наличие детекций
|
27 |
if len(detections) == 0:
|
28 |
+
return image_cv, None
|
29 |
|
30 |
result_np_image = detections[0].plot()
|
31 |
result_np_image = cv2.cvtColor(result_np_image, cv2.COLOR_BGR2RGB)
|
|
|
69 |
return None, None
|
70 |
|
71 |
result_np_image, detected_fruit = detect_fruit(image)
|
72 |
+
if len(detections) == 0:
|
73 |
gr.Info('Не удалось определить товар')
|
74 |
+
return None, None
|
75 |
|
76 |
receipt = create_receipt(detected_fruit, weight)
|
77 |
return result_np_image, receipt
|