Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,12 @@ detections = []
|
|
23 |
|
24 |
# =========================== ДЕТЕКЦИЯ ПЛОДА ============================
|
25 |
|
26 |
-
def
|
27 |
-
|
28 |
-
detections =
|
|
|
|
|
|
|
29 |
detected_fruit = None
|
30 |
|
31 |
for det in detections:
|
@@ -87,6 +90,6 @@ gr.Interface(
|
|
87 |
fn=gradio_interface,
|
88 |
inputs=[image_input, weight_input],
|
89 |
outputs=[image_output, receipt_output],
|
90 |
-
title="Определение
|
91 |
-
description="Загрузите
|
92 |
).launch()
|
|
|
23 |
|
24 |
# =========================== ДЕТЕКЦИЯ ПЛОДА ============================
|
25 |
|
26 |
+
def detect_image(image_path: str, weight: float):
|
27 |
+
image = cv2.imread(image_path)
|
28 |
+
detections = model.predict(source=image_path, conf=0.5)
|
29 |
+
result_np_image = detections[0].plot()
|
30 |
+
result_np_image = cv2.cvtColor(result_np_image, cv2.COLOR_BGR2RGB)
|
31 |
+
return result_np_image
|
32 |
detected_fruit = None
|
33 |
|
34 |
for det in detections:
|
|
|
90 |
fn=gradio_interface,
|
91 |
inputs=[image_input, weight_input],
|
92 |
outputs=[image_output, receipt_output],
|
93 |
+
title="Определение плода и создание чека",
|
94 |
+
description="Загрузите изображение, введите вес и получите чек"
|
95 |
).launch()
|