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 image
|
29 |
|
30 |
result_np_image = detections[0].plot()
|
31 |
result_np_image = cv2.cvtColor(result_np_image, cv2.COLOR_BGR2RGB)
|
@@ -33,7 +33,9 @@ def detect_fruit(image):
|
|
33 |
detected_fruit = None
|
34 |
|
35 |
for det in detections:
|
36 |
-
|
|
|
|
|
37 |
if label in fruits_data:
|
38 |
detected_fruit = label
|
39 |
break
|
@@ -93,7 +95,7 @@ image_output = gr.Image(
|
|
93 |
)
|
94 |
receipt_output = gr.Image(
|
95 |
label="Чек",
|
96 |
-
type="
|
97 |
width=640,
|
98 |
height=480
|
99 |
)
|
|
|
25 |
|
26 |
# Проверка на наличие детекций
|
27 |
if len(detections) == 0:
|
28 |
+
return image, None
|
29 |
|
30 |
result_np_image = detections[0].plot()
|
31 |
result_np_image = cv2.cvtColor(result_np_image, cv2.COLOR_BGR2RGB)
|
|
|
33 |
detected_fruit = None
|
34 |
|
35 |
for det in detections:
|
36 |
+
print('kekkekek')
|
37 |
+
print(det.boxes.cls)
|
38 |
+
label = model.names[int(det.boxes.cls)] # название фрукта
|
39 |
if label in fruits_data:
|
40 |
detected_fruit = label
|
41 |
break
|
|
|
95 |
)
|
96 |
receipt_output = gr.Image(
|
97 |
label="Чек",
|
98 |
+
type="auto",
|
99 |
width=640,
|
100 |
height=480
|
101 |
)
|