linoyts HF Staff commited on
Commit
b40401b
·
verified ·
1 Parent(s): 4f68b12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -116,9 +116,9 @@ def process_video_for_canny(video, width, height):
116
  canny_video = []
117
  detect_resolution = max(video[0].size[0],video[0].size[1])
118
  image_resolution = max(width, height)
119
-
120
- for frame in video:
121
- canny_video.append(canny_processor(frame, low_threshold=50, high_threshold=200, detect_resolution=detect_resolution, image_resolution=image_resolution))
122
 
123
  return canny_video
124
 
@@ -132,7 +132,7 @@ def process_input_video(reference_video, width, height,
132
 
133
  try:
134
  # Load video into a list of PIL images
135
- video = load_video(reference_video)
136
 
137
  # Process video for canny edges
138
  processed_video = process_video_for_canny(video, width, height)
@@ -150,7 +150,7 @@ def process_input_video(reference_video, width, height,
150
 
151
  def process_video_for_control(reference_video, control_type, width, height):
152
  """Process video based on the selected control type - now only used for non-canny types"""
153
- video = load_video(reference_video)
154
 
155
  if control_type == "canny":
156
  # This should not be called for canny since it's pre-processed
 
116
  canny_video = []
117
  detect_resolution = max(video[0].size[0],video[0].size[1])
118
  image_resolution = max(width, height)
119
+ with imageio.get_reader(video) as reader:
120
+ for frame in reader:
121
+ canny_video.append(canny_processor(frame, low_threshold=50, high_threshold=200, detect_resolution=detect_resolution, image_resolution=image_resolution))
122
 
123
  return canny_video
124
 
 
132
 
133
  try:
134
  # Load video into a list of PIL images
135
+ #video = load_video(reference_video)
136
 
137
  # Process video for canny edges
138
  processed_video = process_video_for_canny(video, width, height)
 
150
 
151
  def process_video_for_control(reference_video, control_type, width, height):
152
  """Process video based on the selected control type - now only used for non-canny types"""
153
+ # video = load_video(reference_video)
154
 
155
  if control_type == "canny":
156
  # This should not be called for canny since it's pre-processed