roychao19477 commited on
Commit
397df48
·
1 Parent(s): 75fe888

Test on lengths

Browse files
Files changed (1) hide show
  1. app.py +2 -21
app.py CHANGED
@@ -170,24 +170,6 @@ def yolo_detection(frame, verbose=False):
170
 
171
  @spaces.GPU
172
  def extract_faces(video_file):
173
- if isinstance(video_input, dict):
174
- video_path = video_input.get("path") or video_input.get("url")
175
- if video_path.startswith("http"):
176
- # download video
177
- tmpdir = tempfile.mkdtemp()
178
- ext = os.path.splitext(urlparse(video_path).path)[1]
179
- local_path = os.path.join(tmpdir, "input_video" + ext)
180
- with open(local_path, "wb") as f:
181
- f.write(requests.get(video_path).content)
182
- video_file = local_path
183
- else:
184
- video_file = video_path
185
- else:
186
- video_file = video_input # string path from UI
187
-
188
-
189
-
190
-
191
  cap = cv2.VideoCapture(video_file)
192
  fps = cap.get(cv2.CAP_PROP_FPS)
193
  frames = []
@@ -274,10 +256,9 @@ def extract_faces(video_file):
274
 
275
  iface = gr.Interface(
276
  fn=extract_faces,
277
- #inputs=gr.Video(label="Upload or record your video"),
278
- inputs=gr.File(label="Upload your video", file_types=[".mp4"]),
279
  outputs=[
280
- gr.Video(label="Detected Face Only Video"),
281
  #gr.Audio(label="Extracted Audio (16kHz)", type="filepath"),
282
  gr.Audio(label="Enhanced Audio", type="filepath")
283
  ],
 
170
 
171
  @spaces.GPU
172
  def extract_faces(video_file):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  cap = cv2.VideoCapture(video_file)
174
  fps = cap.get(cv2.CAP_PROP_FPS)
175
  frames = []
 
256
 
257
  iface = gr.Interface(
258
  fn=extract_faces,
259
+ inputs=gr.Video(label="Upload or record your video"),
 
260
  outputs=[
261
+ gr.Video(label="Detected Face Only Video", type="filepath"),
262
  #gr.Audio(label="Extracted Audio (16kHz)", type="filepath"),
263
  gr.Audio(label="Enhanced Audio", type="filepath")
264
  ],