sdafd commited on
Commit
d4dc4f2
·
verified ·
1 Parent(s): 09165b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -1,17 +1,21 @@
1
  import gradio as gr
2
  from ProcessVideo import process_video
3
 
4
- # Gradio function to handle the video upload and processing
5
- def gradio_video_processing(video):
6
- video_path = video # Gradio provides the uploaded video file path
7
- output_video_path = process_video(video_path) # Process the video and get the output path
8
- return output_video_path
9
 
10
- # Gradio Interface
11
  video_input = gr.Video(label="Upload a Video")
12
- video_output = gr.Video(label="Processed Video")
13
-
14
- # Create and launch Gradio interface
15
- gr.Interface(fn=gradio_video_processing, inputs=video_input, outputs=video_output, title="Fight Detection in Video").launch()
16
 
 
 
17
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from ProcessVideo import process_video
3
 
4
+ def gradio_video_processing(video, sequence_length=40, threshold=0.8, output_frame_rate=30):
5
+ output_video, json_response = process_video(video, sequence_length, threshold, output_frame_rate)
6
+ return output_video, json_response
 
 
7
 
 
8
  video_input = gr.Video(label="Upload a Video")
9
+ sequence_length_slider = gr.Slider(minimum=10, maximum=100, step=1, value=40, label="Sequence Length")
10
+ threshold_slider = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.8, label="Detection Threshold")
11
+ frame_rate_slider = gr.Slider(minimum=10, maximum=60, step=1, value=30, label="Output Frame Rate")
 
12
 
13
+ video_output = gr.Video(label="Processed Video")
14
+ json_output = gr.JSON(label="Processing Results")
15
 
16
+ gr.Interface(
17
+ fn=gradio_video_processing,
18
+ inputs=[video_input, sequence_length_slider, threshold_slider, frame_rate_slider],
19
+ outputs=[video_output, json_output],
20
+ title="Fight Detection in Video"
21
+ ).launch()