linoyts HF Staff commited on
Commit
a6defd8
Β·
verified Β·
1 Parent(s): 60ba02f

Update app.py

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