Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ model = YOLO("yolov11m_best.pt")
|
|
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):
|
19 |
# считываем изображение
|
20 |
# предполагается, что image - это объект PIL Image
|
@@ -40,7 +40,7 @@ def detect_fruit(image):
|
|
40 |
|
41 |
return result_np_image, detected_fruit
|
42 |
|
43 |
-
# =========================== ЧЕК
|
44 |
def create_receipt(detected_fruit, weight):
|
45 |
data = fruits_data[detected_fruit]
|
46 |
fruit_name = data['name']
|
@@ -62,7 +62,7 @@ def create_receipt(detected_fruit, weight):
|
|
62 |
|
63 |
return receipt_img
|
64 |
|
65 |
-
# ======================= ИНТЕРФЕЙС
|
66 |
def gradio_interface(image, weight):
|
67 |
if weight <= 0:
|
68 |
gr.Info('Укажите вес товара')
|
|
|
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):
|
19 |
# считываем изображение
|
20 |
# предполагается, что image - это объект PIL Image
|
|
|
40 |
|
41 |
return result_np_image, detected_fruit
|
42 |
|
43 |
+
# =========================== ЧЕК ================================
|
44 |
def create_receipt(detected_fruit, weight):
|
45 |
data = fruits_data[detected_fruit]
|
46 |
fruit_name = data['name']
|
|
|
62 |
|
63 |
return receipt_img
|
64 |
|
65 |
+
# ======================= ИНТЕРФЕЙС ===============================
|
66 |
def gradio_interface(image, weight):
|
67 |
if weight <= 0:
|
68 |
gr.Info('Укажите вес товара')
|