Paradise151 commited on
Commit
6f9bbe2
·
verified ·
1 Parent(s): 074887a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -30,7 +30,7 @@ def predict_webcam(img, conf_threshold, iou_threshold):
30
  return last_annotated_frame # Возвращаем последний кадр, если новый не пришел
31
 
32
  # Исправляем зеркальное отражение
33
- # img = cv2.flip(img, 1)
34
 
35
  # frame_counter += 1
36
  # if frame_counter % FRAME_SKIP != 0 and last_annotated_frame is not None:
@@ -53,13 +53,14 @@ def predict_webcam(img, conf_threshold, iou_threshold):
53
  annotated_frame = results[0].plot()
54
 
55
  # Преобразование цвета из BGR (OpenCV) в RGB (Gradio)
56
- annotated_frame_rgb = cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB)
57
 
58
  # Сохраняем последний успешно обработанный кадр
59
- last_annotated_frame = annotated_frame_rgb
60
-
61
- return annotated_frame_rgb
62
-
 
63
 
64
  # --- Определение интерфейса Gradio ---
65
  iface = gr.Interface(
 
30
  return last_annotated_frame # Возвращаем последний кадр, если новый не пришел
31
 
32
  # Исправляем зеркальное отражение
33
+ img = cv2.flip(img, 1)
34
 
35
  # frame_counter += 1
36
  # if frame_counter % FRAME_SKIP != 0 and last_annotated_frame is not None:
 
53
  annotated_frame = results[0].plot()
54
 
55
  # Преобразование цвета из BGR (OpenCV) в RGB (Gradio)
56
+ # annotated_frame_rgb = cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB)
57
 
58
  # Сохраняем последний успешно обработанный кадр
59
+ # last_annotated_frame = annotated_frame_rgb
60
+ last_annotated_frame = annotated_frame
61
+
62
+ # return annotated_frame_rgb
63
+ return annotated_frame
64
 
65
  # --- Определение интерфейса Gradio ---
66
  iface = gr.Interface(