File size: 830 Bytes
754d1ac
16fef35
 
7af7df6
4d3f71f
754d1ac
 
 
4d3f71f
754d1ac
16fef35
4d3f71f
b655741
 
754d1ac
a8a198c
24802c8
754d1ac
2b717f1
b655741
 
24802c8
b655741
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from video2images import Video2Images
import os

def extract_frames(video_path):
    # Temporary directory to store frames
    temp_dir = "temp_frames"
    os.makedirs(temp_dir, exist_ok=True)
    # Use the provided video path for extracting frames
    out_filepath = os.path.join(temp_dir, "extracted_frames")
    # Create Video2Images object
    v2i = Video2Images(video_path, out_dir=out_filepath)
    # Extract frames
    v2i.start()
    return out_filepath  # Return the directory where frames are saved

inputs = gr.Video(label="Upload Video")
outputs = gr.Textbox(label="Output Directory")

title = "Extract Frames from Video"
description = "Upload a video file and extract frames from it."

gr.Interface(fn=extract_frames, inputs=inputs, outputs=outputs, title=title, description=description).launch()