Rahatara commited on
Commit
0c4b1bf
·
verified ·
1 Parent(s): 6bb8339

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -1,9 +1,7 @@
1
  import cv2
2
  import gradio as gr
3
- from pathlib import Path
4
- from typing import Union, Tuple
5
 
6
- def frame_capture(video_path: str) -> Tuple[str, None]:
7
  # Function to extract frames
8
  vidObj = cv2.VideoCapture(video_path)
9
 
@@ -24,15 +22,15 @@ def frame_capture(video_path: str) -> Tuple[str, None]:
24
  frames.append(image)
25
  count += 1
26
 
27
- return frames, None
28
 
29
- def extract_frames(video: str) -> Tuple[str, None]:
30
- frames, _ = frame_capture(video)
31
- return frames, None
32
 
33
  # Define the Gradio interface
34
  video_input = gr.Video(label="Upload Video")
35
- output_frames = gr.Image(label='Frame', type='pil')
36
 
37
  # Create the Gradio app
38
  gr.Interface(fn=extract_frames, inputs=video_input, outputs=output_frames, title='Video Frame Extractor').launch()
 
1
  import cv2
2
  import gradio as gr
 
 
3
 
4
+ def frame_capture(video_path):
5
  # Function to extract frames
6
  vidObj = cv2.VideoCapture(video_path)
7
 
 
22
  frames.append(image)
23
  count += 1
24
 
25
+ return frames
26
 
27
+ def extract_frames(video):
28
+ frames = frame_capture(video.value)
29
+ return frames
30
 
31
  # Define the Gradio interface
32
  video_input = gr.Video(label="Upload Video")
33
+ output_frames = gr.Gallery(label='Frame')
34
 
35
  # Create the Gradio app
36
  gr.Interface(fn=extract_frames, inputs=video_input, outputs=output_frames, title='Video Frame Extractor').launch()