goryhon commited on
Commit
fc7627a
·
verified ·
1 Parent(s): 859696e

Update web-demos/hugging_face/app.py

Browse files
Files changed (1) hide show
  1. web-demos/hugging_face/app.py +6 -1
web-demos/hugging_face/app.py CHANGED
@@ -108,7 +108,12 @@ def get_frames_from_video(video_input, video_state):
108
  except (OSError, TypeError, ValueError, KeyError, SyntaxError) as e:
109
  status_ok = False
110
  print("read_frame_source:{} error. {}\n".format(video_path, str(e)))
111
-
 
 
 
 
 
112
  # initialize video_state
113
  if frames[0].shape[0] > 720 or frames[0].shape[1] > 720:
114
  operation_log = [(f"Video uploaded! Try to click the image shown in step2 to add masks. (You uploaded a video with a size of {original_w}x{original_h}, and the length of its longest edge exceeds 720 pixels. We may resize the input video during processing.)", "Normal")]
 
108
  except (OSError, TypeError, ValueError, KeyError, SyntaxError) as e:
109
  status_ok = False
110
  print("read_frame_source:{} error. {}\n".format(video_path, str(e)))
111
+
112
+ if not frames:
113
+ raise ValueError("Не удалось извлечь кадры из видео. Проверьте файл.")
114
+ print("Загружено кадров:", len(frames))
115
+ print("Тип frames:", type(frames))
116
+
117
  # initialize video_state
118
  if frames[0].shape[0] > 720 or frames[0].shape[1] > 720:
119
  operation_log = [(f"Video uploaded! Try to click the image shown in step2 to add masks. (You uploaded a video with a size of {original_w}x{original_h}, and the length of its longest edge exceeds 720 pixels. We may resize the input video during processing.)", "Normal")]