Update app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,54 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pipeline
|
| 3 |
|
|
|
|
| 4 |
custom_css = """
|
| 5 |
-
.gradio-container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
"""
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
image_interface = gr.Interface(
|
| 9 |
fn=pipeline.deepfakes_image_predict,
|
| 10 |
inputs=gr.Image(label="Upload Image", height=500),
|
| 11 |
-
outputs=gr.Textbox(label="Detection Result", lines=8),
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
)
|
| 14 |
|
|
|
|
| 15 |
video_interface = gr.Interface(
|
| 16 |
fn=pipeline.deepfakes_video_predict,
|
| 17 |
inputs=gr.Video(label="Upload Video", height=500),
|
| 18 |
-
outputs=gr.Textbox(label="Detection Result", lines=8),
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
app = gr.TabbedInterface(
|
| 23 |
-
interface_list=[image_interface, video_interface],
|
| 24 |
tab_names=['Image inference', 'Video inference'],
|
| 25 |
css=custom_css
|
| 26 |
)
|
| 27 |
|
| 28 |
-
if __name__ ==
|
| 29 |
app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pipeline
|
| 3 |
|
| 4 |
+
# Custom CSS for larger interface
|
| 5 |
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 {
|
| 13 |
+
min-height: 300px !important;
|
| 14 |
+
font-size: 24px !important;
|
| 15 |
+
padding: 30px !important;
|
| 16 |
+
}
|
| 17 |
+
.input-image, .input-video, .input-audio {
|
| 18 |
+
min-height: 500px !important;
|
| 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 with larger components
|
| 26 |
image_interface = gr.Interface(
|
| 27 |
fn=pipeline.deepfakes_image_predict,
|
| 28 |
inputs=gr.Image(label="Upload Image", height=500),
|
| 29 |
+
outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
|
| 30 |
+
examples=["images/images_lady.jpg", "images/images_fake_image.jpg"],
|
| 31 |
+
cache_examples=False,
|
| 32 |
+
title="Image Deepfake Detection",
|
| 33 |
+
description="Upload an image to detect if it's real or fake"
|
| 34 |
)
|
| 35 |
|
| 36 |
+
# Video Interface with larger components
|
| 37 |
video_interface = gr.Interface(
|
| 38 |
fn=pipeline.deepfakes_video_predict,
|
| 39 |
inputs=gr.Video(label="Upload Video", height=500),
|
| 40 |
+
outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
|
| 41 |
+
examples=["videos/celeb_synthesis.mp4", "videos/real-1.mp4"],
|
| 42 |
+
cache_examples=False,
|
| 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 |
app = gr.TabbedInterface(
|
| 48 |
+
interface_list=[image_interface, video_interface],
|
| 49 |
tab_names=['Image inference', 'Video inference'],
|
| 50 |
css=custom_css
|
| 51 |
)
|
| 52 |
|
| 53 |
+
if __name__ == '__main__':
|
| 54 |
app.launch()
|