| import gradio as gr |
|
|
| |
| from fake_text import hybrid_analysis |
| from fake_audio import analyze_voice_forensics |
| from fake_video import analyze_video as video_pipeline |
| from final_lipsync import master_pipeline as lipsync_pipeline |
|
|
| |
| with gr.Blocks(theme=gr.themes.Soft(), title="Unified Deepfake Detector") as demo: |
| gr.Markdown("<h1 style='text-align: center;'>π‘οΈ Unified AI Deepfake & Forensic Detection System</h1>") |
| gr.Markdown("<p style='text-align: center;'>Comprehensive analysis across Text, Audio, Video, and Lip-Sync domains.</p>") |
| |
| with gr.Tabs(): |
| |
| |
| with gr.TabItem("π° Fake Text/News"): |
| gr.Markdown("### π§ Text Claim Analysis (Hybrid DeBERTa + Groq)") |
| with gr.Row(): |
| text_in = gr.Textbox(label="Enter News Claim", placeholder="e.g., The Eiffel Tower was sold today...") |
| with gr.Row(): |
| text_btn = gr.Button("π Analyze Claim", variant="primary") |
| with gr.Row(): |
| text_out = gr.HTML(label="Verdict & Reasoning") |
| |
| text_btn.click(hybrid_analysis, inputs=[text_in], outputs=[text_out]) |
|
|
| |
| with gr.TabItem("ποΈ Audio Forensics"): |
| gr.Markdown("### π Audio DNA, Texture & Splice Analysis") |
| with gr.Row(): |
| aud_in = gr.Audio(type="filepath", label="Upload Forensic Sample") |
| with gr.Row(): |
| aud_btn = gr.Button("π Run Fuzzy Audit", variant="primary") |
| with gr.Row(): |
| with gr.Column(): |
| aud_v_out = gr.Textbox(label="Final Verdict") |
| aud_e_out = gr.Textbox(label="Categorized Evidence (Metrics)") |
| with gr.Column(): |
| aud_r_out = gr.Textbox(label="Forensic Reasoning (Claude/Groq)", lines=4) |
| |
| aud_btn.click(analyze_voice_forensics, inputs=[aud_in], outputs=[aud_v_out, aud_e_out, aud_r_out]) |
|
|
| |
| with gr.TabItem("π₯ Video Forensics"): |
| gr.Markdown("### π Video Motion (VideoMAE) & Semantic Analysis (ViT)") |
| with gr.Row(): |
| vid_in = gr.Video(label="Upload Video for Analysis") |
| vid_btn = gr.Button("π Analyze Video", variant="primary") |
| with gr.Row(): |
| with gr.Column(): |
| vid_img_out = gr.Image(label="Suspicious Keyframe", type="pil") |
| with gr.Column(): |
| vid_txt_out = gr.Markdown() |
| with gr.Row(): |
| vid_reason_out = gr.Textbox(label="Judge's Evidence", lines=5) |
| vid_hidden = gr.Textbox(visible=False) |
| |
| vid_btn.click(video_pipeline, inputs=[vid_in], outputs=[vid_img_out, vid_txt_out, vid_reason_out, vid_hidden]) |
|
|
| |
| with gr.TabItem("π Master Pipeline (Lip-Sync)"): |
| gr.Markdown("### βοΈ Multi-Modal Analysis: Video + Audio + LSE-Net Binding") |
| with gr.Row(): |
| master_vid_in = gr.Video(label="Upload Investigation Video (MP4)") |
| master_btn = gr.Button("π Run Master Analysis", variant="primary") |
| with gr.Row(): |
| with gr.Column(): |
| master_img_out = gr.Image(label="Keyframe Analysis") |
| with gr.Column(): |
| master_txt_out = gr.Markdown(label="Master Report") |
| with gr.Row(): |
| master_reason_out = gr.Textbox(label="Judge Reasoning Log", lines=3) |
| |
| master_btn.click(lipsync_pipeline, inputs=[master_vid_in], outputs=[master_img_out, master_txt_out, master_reason_out]) |
|
|
| |
| if __name__ == "__main__": |
| |
| demo.launch(share=True, debug=True) |