Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,8 @@ from ultralytics import YOLO
|
|
11 |
model = YOLO("yolov11m_best.pt")
|
12 |
|
13 |
# ================== ЧТЕНИЕ НАЗВАНИЙ И ЦЕН =======================
|
14 |
-
with open('Fruit_Veggies_Price.json', 'r', encoding='utf-8') as file:
|
15 |
-
|
16 |
|
17 |
# =========================== ДЕТЕКЦИЯ ПЛОДА ============================
|
18 |
def detect_fruit(image, weight: float):
|
@@ -70,13 +70,13 @@ def detect_fruit(image, weight: float):
|
|
70 |
# return output.getvalue()
|
71 |
|
72 |
# ======================= ИНТЕРФЕЙС ============================
|
73 |
-
def gradio_interface(image
|
74 |
# if weight <= 0:
|
75 |
# return image
|
76 |
|
77 |
-
detected_image
|
78 |
-
if not fruit_name:
|
79 |
-
|
80 |
# return image, None # Вернуть пустой чек
|
81 |
|
82 |
return detected_image
|
@@ -84,7 +84,7 @@ def gradio_interface(image, weight):
|
|
84 |
# return image, receipt
|
85 |
|
86 |
image_input = gr.Image(label="Изображение")
|
87 |
-
weight_input = gr.Number(label="Вес (кг)")
|
88 |
image_output = gr.Image(label="Распознанный фрукт", type="numpy")
|
89 |
# receipt_output = gr.Image(label="Чек", type="numpy")
|
90 |
|
|
|
11 |
model = YOLO("yolov11m_best.pt")
|
12 |
|
13 |
# ================== ЧТЕНИЕ НАЗВАНИЙ И ЦЕН =======================
|
14 |
+
# with open('Fruit_Veggies_Price.json', 'r', encoding='utf-8') as file:
|
15 |
+
# fruits_data = json.load(file)
|
16 |
|
17 |
# =========================== ДЕТЕКЦИЯ ПЛОДА ============================
|
18 |
def detect_fruit(image, weight: float):
|
|
|
70 |
# return output.getvalue()
|
71 |
|
72 |
# ======================= ИНТЕРФЕЙС ============================
|
73 |
+
def gradio_interface(image):
|
74 |
# if weight <= 0:
|
75 |
# return image
|
76 |
|
77 |
+
detected_image = detect_fruit(image)
|
78 |
+
# if not fruit_name:
|
79 |
+
# return image
|
80 |
# return image, None # Вернуть пустой чек
|
81 |
|
82 |
return detected_image
|
|
|
84 |
# return image, receipt
|
85 |
|
86 |
image_input = gr.Image(label="Изображение")
|
87 |
+
# weight_input = gr.Number(label="Вес (кг)")
|
88 |
image_output = gr.Image(label="Распознанный фрукт", type="numpy")
|
89 |
# receipt_output = gr.Image(label="Чек", type="numpy")
|
90 |
|