wickedreg commited on
Commit
76c32f4
·
verified ·
1 Parent(s): 38abe15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -23,9 +23,12 @@ detections = []
23
 
24
  # =========================== ДЕТЕКЦИЯ ПЛОДА ============================
25
 
26
- def detect_fruit(image, weight):
27
- results = model.predict(source=image, conf=0.5)
28
- detections = results[0].boxes.data.tolist()
 
 
 
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()