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()