Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from inference import predict_image, predict_video | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 🎭 Deepfake Detection ") | |
| with gr.Tabs(): | |
| with gr.TabItem("Image"): | |
| img_input = gr.Image(type="pil") | |
| img_btn = gr.Button("Analyze Image") | |
| img_output = gr.Text(label="Prediction") | |
| img_cam = gr.Image(label="Grad-CAM") | |
| img_btn.click(fn=predict_image, inputs=img_input, outputs=[img_output, img_cam]) | |
| with gr.TabItem("Video"): | |
| vid_input = gr.Video() | |
| vid_btn = gr.Button("Analyze Video") | |
| vid_output = gr.Text(label="Final Prediction") | |
| vid_gallery = gr.Gallery(label="Grad-CAM Frames", columns=4, height="auto") | |
| vid_chart = gr.Image(label="Per-frame Confidence Chart") | |
| vid_btn.click( | |
| fn=predict_video, | |
| inputs=vid_input, | |
| outputs=[vid_output, vid_gallery, vid_chart] | |
| ) | |
| demo.launch(share=True) | |