Spaces:
Sleeping
Sleeping
File size: 895 Bytes
8e081b1 81ca9d7 45b94ab 0c4b1bf 8e081b1 45b94ab 8e081b1 45b94ab 8e081b1 45b94ab 0c4b1bf 8e081b1 81ca9d7 45b94ab 8e081b1 45b94ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import cv2
import gradio as gr
# get the frames
def frame_capture(video_path):
# Function to extract frames
vidObj = cv2.VideoCapture(video_path)
# Used as counter variable
count = 0
frames = []
# checks whether frames were extracted
success = 1
while success:
# vidObj object calls read
# function to extract frames
success, image = vidObj.read()
# Append the frame to the list
if success:
frames.append(image)
count += 1
return frames
def extract_frames(video):
frames = frame_capture(video)
return frames
# Define the Gradio interface
video_input = gr.Video(label="Upload Video", autoplay=True)
output_frames = gr.Gallery(label='Frame')
# Create the Gradio app
gr.Interface(fn=extract_frames, inputs=video_input, outputs=output_frames, title='Video Frame Extractor').launch() |