File size: 985 Bytes
43d674a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from create_video_from_frames import main, EFFECTS

def process_video(video, effect_name, interval, fps):
    # video_path = video.name
    output_path = f"output_{effect_name.replace(' ', '_')}.mp4"
    result_path = main(
        video_file=video,
        output_file=output_path,
        effect_name=effect_name,
        interval=interval,
        fps=fps
    )
    return result_path

demo = gr.Interface(
    fn=process_video,
    inputs=[
        gr.Video(label="Upload Video"),
        gr.Dropdown(list(EFFECTS.keys()), label="Choose Effect", value="Zoom Center"),
        gr.Slider(minimum=1, maximum=10, step=1, value=5, label="Frame Interval (seconds)"),
        gr.Slider(minimum=5, maximum=60, step=1, value=30, label="Output FPS"),
    ],
    outputs=gr.Video(label="Processed Video"),
    title="๐ŸŽž๏ธ Video Effect Generator",
    description="Upload a video, select a visual effect, and process it with original audio preserved.",
)

demo.launch()