VeuReu commited on
Commit
e32f733
verified
1 Parent(s): 3b5ea0e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from api import pipeline_video_analysis
3
+
4
+ def gradio_process_video(video_file, threshold, offset_frames, crop_ratio):
5
+ images, scenes_info = pipeline_video_analysis(video_file, threshold, offset_frames, crop_ratio)
6
+ return images, scenes_info
7
+
8
+ with gr.Blocks() as demo:
9
+ gr.Markdown("# Extracci贸n de escenas con svision")
10
+
11
+ with gr.Row():
12
+ video_input = gr.Video(label="Sube un v铆deo")
13
+ threshold_slider = gr.Slider(0.0, 100.0, value=30.0, label="Threshold")
14
+ offset_slider = gr.Slider(0, 30, value=10, step=1, label="Offset frames")
15
+ crop_slider = gr.Slider(0.0, 1.0, value=0.1, step=0.05, label="Crop ratio")
16
+ btn = gr.Button("Extraer escenas")
17
+
18
+ gallery_out = gr.Gallery(label="Fotogramas clave", show_label=False, columns=4, height="auto")
19
+ json_out = gr.JSON(label="Informaci贸n de escenas")
20
+
21
+ btn.click(gradio_process_video, [video_input, threshold_slider, offset_slider, crop_slider], [gallery_out, json_out])
22
+
23
+ demo.launch()