pavankumarvk commited on
Commit
fea3595
·
verified ·
1 Parent(s): d9a982f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -48
app.py CHANGED
@@ -1,67 +1,29 @@
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 Detector"
23
- description = "Multimodal Deepfake Detection using EfficientNetV2 (Video/Image) and RawNet (Audio)."
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
- # Audio Interface (New)
48
- audio_interface = gr.Interface(
49
- fn=pipeline.deepfakes_audio_predict,
50
- inputs=gr.Audio(sources=["upload", "microphone"], label="Upload Audio", type="numpy"),
51
- outputs=gr.Textbox(label="Detection Result", lines=8, scale=2),
52
- # examples=["audio/real_sample.wav", "audio/fake_sample.wav"], # Uncomment if you have example audio files
53
- cache_examples=False,
54
- title="Audio Deepfake Detection",
55
- description="Upload an audio file or record microphone to detect if it's real or fake (Deepfake)"
56
  )
57
 
58
  app = gr.TabbedInterface(
59
- interface_list=[image_interface, video_interface, audio_interface],
60
- tab_names=['Image inference', 'Video inference', 'Audio inference'],
61
- css=custom_css,
62
- title=title,
63
- theme=gr.themes.Soft()
64
  )
65
 
66
- if __name__ == '__main__':
67
- app.launch()
 
1
  import gradio as gr
2
  import pipeline
3
 
 
4
  custom_css = """
5
+ .gradio-container { max-width: 1400px !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ title="Image Deepfake Detection"
 
 
 
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
+ title="Video Deepfake Detection"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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__ == "__main__":
29
+ app.launch()