import gradio as gr from ProcessVideo import process_video def gradio_video_processing(video, sequence_length=40, threshold=0.8, output_frame_rate=30): output_video, json_response = process_video(video, sequence_length, threshold, output_frame_rate) return output_video, json_response video_input = gr.Video(label="Upload a Video") sequence_length_slider = gr.Slider(minimum=10, maximum=100, step=1, value=40, label="Sequence Length") threshold_slider = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.8, label="Detection Threshold") frame_rate_slider = gr.Slider(minimum=10, maximum=60, step=1, value=30, label="Output Frame Rate") video_output = gr.Video(label="Processed Video") json_output = gr.JSON(label="Processing Results") gr.Interface( fn=gradio_video_processing, inputs=[video_input, sequence_length_slider, threshold_slider, frame_rate_slider], outputs=[video_output, json_output], title="Fight Detection in Video" ).launch()