import gradio as gr from run import get_model, detect_video model = get_model() def greet(video): print(video, type(video)) pred = detect_video(video_path=video, model=model) if pred > 0.5: string = f"Fake: {pred*100:.2f}%" else: string = f"Real: {(1-pred)*100:.2f}%" print(string) return string with gr.Blocks() as demo: gr.Markdown("# Fake Video Detector") with gr.Tabs(): with gr.TabItem("Video Detect"): with gr.Row(): video_input = gr.Video() detect_output = gr.Textbox("Output") video_button = gr.Button("detect") video_button.click(greet, inputs=video_input, outputs=detect_output) demo.launch()