import gradio as gr from api import pipeline_video_analysis def gradio_process_video(video_file, threshold, offset_frames, crop_ratio): images, scenes_info = pipeline_video_analysis(video_file, threshold, offset_frames, crop_ratio) return images, scenes_info with gr.Blocks() as demo: gr.Markdown("# Extracción de escenas con svision") with gr.Row(): video_input = gr.Video(label="Sube un vídeo") threshold_slider = gr.Slider(0.0, 100.0, value=30.0, label="Threshold") offset_slider = gr.Slider(0, 30, value=10, step=1, label="Offset frames") crop_slider = gr.Slider(0.0, 1.0, value=0.1, step=0.05, label="Crop ratio") btn = gr.Button("Extraer escenas") gallery_out = gr.Gallery(label="Fotogramas clave", show_label=False, columns=4, height="auto") json_out = gr.JSON(label="Información de escenas") btn.click(gradio_process_video, [video_input, threshold_slider, offset_slider, crop_slider], [gallery_out, json_out]) demo.launch()