pavankumarvk's picture
Update app.py
86e4cd2 verified
import gradio as gr
import pipeline
custom_css = """
.gradio-container {
max-width: 1400px !important;
}
#component-0, #component-1, #component-2, #component-3 {
min-height: 500px !important;
}
.output-class {
min-height: 300px !important;
font-size: 24px !important;
padding: 30px !important;
}
.input-image, .input-video, .input-audio {
min-height: 500px !important;
}
"""
title = "EfficientNetV2 Deepfakes Video Detector"
description = "EfficientNetV2 Deepfakes Image Detector by using frame-by-frame detection."
image_interface = gr.Interface(
fn=pipeline.deepfakes_image_predict,
inputs=gr.Image(label="Upload Image", height=500),
outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
examples=["images/images_lady.jpg", "images/images_fake_image.jpg"],
cache_examples=False,
title="Image Deepfake Detection",
description="Upload an image to detect if it's real or fake"
)
video_interface = gr.Interface(
fn=pipeline.deepfakes_video_predict,
inputs=gr.Video(label="Upload Video", height=500),
outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
examples=["videos/celeb_synthesis.mp4", "videos/real-1.mp4"],
cache_examples=False,
title="Video Deepfake Detection",
description="Upload a video to detect if it's real or fake (frame-by-frame analysis)"
)
audio_interface = gr.Interface(
fn=pipeline.deepfakes_audio_predict,
inputs=gr.Audio(),
outputs=gr.Textbox(),
title="Audio Deepfake Detection"
)
text_interface = gr.Interface(
fn=pipeline.deepfakes_text_predict,
inputs=gr.Textbox(
label="Input Text",
placeholder=(
"Paste any text here to check if it was written by a human or "
"generated by an AI (articles, essays, emails, descriptions…)"
),
lines=10,
),
outputs=gr.Textbox(
label="Detection Result",
lines=10,
),
examples=[
["The Eiffel Tower, constructed between 1887 and 1889, was designed by engineer Gustave Eiffel as the entrance arch for the 1889 World's Fair held in Paris."],
["In the rapidly evolving landscape of artificial intelligence, large language models have demonstrated remarkable capabilities across a wide range of natural language processing tasks, achieving state-of-the-art performance on numerous benchmarks."],
["Yesterday I went to the market and bought some fresh vegetables. The tomatoes looked really good so I grabbed a few extra ones for the pasta sauce I was planning to make for dinner."],
],
cache_examples=False,
title="AI Text Detection",
description=(
"Paste any text to detect whether it was written by a human or generated by an AI. "
"Powered by a hybrid DeBERTa-v3-small + BiLSTM + CNN + Transformer model."
),
)
app = gr.TabbedInterface(
[image_interface, video_interface, audio_interface, text_interface],
["Image inference", "Video inference", "Audio inference", "Text inference"],
css=custom_css
)
if __name__ == '__main__':
app.launch()