Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ custom_css = """
|
|
| 6 |
.gradio-container {
|
| 7 |
max-width: 1400px !important;
|
| 8 |
}
|
| 9 |
-
#component-0, #component-1, #component-2 {
|
| 10 |
min-height: 500px !important;
|
| 11 |
}
|
| 12 |
.output-class {
|
|
@@ -19,10 +19,10 @@ custom_css = """
|
|
| 19 |
}
|
| 20 |
"""
|
| 21 |
|
| 22 |
-
title="EfficientNetV2 Deepfakes Video Detector"
|
| 23 |
-
description="EfficientNetV2 Deepfakes Image Detector by using frame-by-frame detection."
|
| 24 |
|
| 25 |
-
# Image Interface
|
| 26 |
image_interface = gr.Interface(
|
| 27 |
fn=pipeline.deepfakes_image_predict,
|
| 28 |
inputs=gr.Image(label="Upload Image", height=500),
|
|
@@ -33,7 +33,7 @@ image_interface = gr.Interface(
|
|
| 33 |
description="Upload an image to detect if it's real or fake"
|
| 34 |
)
|
| 35 |
|
| 36 |
-
# Video Interface
|
| 37 |
video_interface = gr.Interface(
|
| 38 |
fn=pipeline.deepfakes_video_predict,
|
| 39 |
inputs=gr.Video(label="Upload Video", height=500),
|
|
@@ -43,6 +43,8 @@ video_interface = gr.Interface(
|
|
| 43 |
title="Video Deepfake Detection",
|
| 44 |
description="Upload a video to detect if it's real or fake (frame-by-frame analysis)"
|
| 45 |
)
|
|
|
|
|
|
|
| 46 |
audio_interface = gr.Interface(
|
| 47 |
fn=pipeline.deepfakes_audio_predict,
|
| 48 |
inputs=gr.Audio(),
|
|
@@ -50,9 +52,39 @@ audio_interface = gr.Interface(
|
|
| 50 |
title="Audio Deepfake Detection"
|
| 51 |
)
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
app = gr.TabbedInterface(
|
| 54 |
-
[image_interface, video_interface, audio_interface],
|
| 55 |
-
[
|
| 56 |
css=custom_css
|
| 57 |
)
|
| 58 |
|
|
|
|
| 6 |
.gradio-container {
|
| 7 |
max-width: 1400px !important;
|
| 8 |
}
|
| 9 |
+
#component-0, #component-1, #component-2, #component-3 {
|
| 10 |
min-height: 500px !important;
|
| 11 |
}
|
| 12 |
.output-class {
|
|
|
|
| 19 |
}
|
| 20 |
"""
|
| 21 |
|
| 22 |
+
title = "EfficientNetV2 Deepfakes Video Detector"
|
| 23 |
+
description = "EfficientNetV2 Deepfakes Image Detector by using frame-by-frame detection."
|
| 24 |
|
| 25 |
+
# ββ Image Interface βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 26 |
image_interface = gr.Interface(
|
| 27 |
fn=pipeline.deepfakes_image_predict,
|
| 28 |
inputs=gr.Image(label="Upload Image", height=500),
|
|
|
|
| 33 |
description="Upload an image to detect if it's real or fake"
|
| 34 |
)
|
| 35 |
|
| 36 |
+
# ββ Video Interface βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 37 |
video_interface = gr.Interface(
|
| 38 |
fn=pipeline.deepfakes_video_predict,
|
| 39 |
inputs=gr.Video(label="Upload Video", height=500),
|
|
|
|
| 43 |
title="Video Deepfake Detection",
|
| 44 |
description="Upload a video to detect if it's real or fake (frame-by-frame analysis)"
|
| 45 |
)
|
| 46 |
+
|
| 47 |
+
# ββ Audio Interface βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 48 |
audio_interface = gr.Interface(
|
| 49 |
fn=pipeline.deepfakes_audio_predict,
|
| 50 |
inputs=gr.Audio(),
|
|
|
|
| 52 |
title="Audio Deepfake Detection"
|
| 53 |
)
|
| 54 |
|
| 55 |
+
# ββ Text Interface ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 56 |
+
# Uses HybridAITextDetector: DeBERTa-v3-small + BiLSTM + CNN + Transformer
|
| 57 |
+
text_interface = gr.Interface(
|
| 58 |
+
fn=pipeline.deepfakes_text_predict,
|
| 59 |
+
inputs=gr.Textbox(
|
| 60 |
+
label="Input Text",
|
| 61 |
+
placeholder=(
|
| 62 |
+
"Paste any text here to check if it was written by a human or "
|
| 63 |
+
"generated by an AI (articles, essays, emails, descriptionsβ¦)"
|
| 64 |
+
),
|
| 65 |
+
lines=10,
|
| 66 |
+
),
|
| 67 |
+
outputs=gr.Textbox(
|
| 68 |
+
label="Detection Result",
|
| 69 |
+
lines=10,
|
| 70 |
+
),
|
| 71 |
+
examples=[
|
| 72 |
+
["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."],
|
| 73 |
+
["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."],
|
| 74 |
+
["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."],
|
| 75 |
+
],
|
| 76 |
+
cache_examples=False,
|
| 77 |
+
title="AI Text Detection",
|
| 78 |
+
description=(
|
| 79 |
+
"Paste any text to detect whether it was written by a human or generated by an AI. "
|
| 80 |
+
"Powered by a hybrid DeBERTa-v3-small + BiLSTM + CNN + Transformer model."
|
| 81 |
+
),
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
# ββ Tabbed App ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 85 |
app = gr.TabbedInterface(
|
| 86 |
+
[image_interface, video_interface, audio_interface, text_interface],
|
| 87 |
+
["Image inference", "Video inference", "Audio inference", "Text inference"],
|
| 88 |
css=custom_css
|
| 89 |
)
|
| 90 |
|