sczhou commited on
Commit
6aa9697
·
1 Parent(s): 5fa813d

add size limit.

Browse files
Files changed (1) hide show
  1. web-demos/hugging_face/app.py +10 -0
web-demos/hugging_face/app.py CHANGED
@@ -86,6 +86,16 @@ def get_frames_from_video(video_input, video_state):
86
  # break
87
  else:
88
  break
 
 
 
 
 
 
 
 
 
 
89
  except (OSError, TypeError, ValueError, KeyError, SyntaxError) as e:
90
  print("read_frame_source:{} error. {}\n".format(video_path, str(e)))
91
  image_size = (frames[0].shape[0],frames[0].shape[1])
 
86
  # break
87
  else:
88
  break
89
+
90
+ # TODO: hard code to avoid out of memory
91
+ t, h, w = len(frames), frames[0].shape[1], frames[0].shape[2]
92
+ print(f'Inp video shape: t_{t}, s_{h}x_{w}')
93
+ if len(frames) > 150 and max(frames[0].shape) > 1024:
94
+ raise ValueError('Due to GPU memory constraints, the current version of this demo supports videos \
95
+ with a maximum length of 150 and a maximum resolution of 1024. \
96
+ We will continue to optimize it after the CVPR 2024 deadline. \
97
+ Please stay tuned!')
98
+
99
  except (OSError, TypeError, ValueError, KeyError, SyntaxError) as e:
100
  print("read_frame_source:{} error. {}\n".format(video_path, str(e)))
101
  image_size = (frames[0].shape[0],frames[0].shape[1])