PraneshJs commited on
Commit
c8e0495
·
verified ·
1 Parent(s): 064f97d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -38
app.py CHANGED
@@ -1,41 +1,34 @@
1
  import gradio as gr
2
  import inference_2 as inference
3
 
4
- title = "Multimodal Deepfake Detector"
5
- description = "Deepfake detection for videos, images and audio modalities."
6
-
7
- # Video interface
8
- video_interface = gr.Interface(
9
- fn=inference.deepfakes_video_predict,
10
- inputs=gr.Video(),
11
- outputs=gr.Textbox(),
12
- cache_examples=False
13
- )
14
-
15
- # Image interface
16
- image_interface = gr.Interface(
17
- fn=inference.deepfakes_image_predict,
18
- inputs=gr.Image(),
19
- outputs=gr.Textbox(),
20
- examples=["images/lady.jpg", "images/fake_image.jpg"],
21
- cache_examples=False
22
- )
23
-
24
- # Audio interface
25
- audio_interface = gr.Interface(
26
- fn=inference.deepfakes_spec_predict,
27
- inputs=gr.Audio(),
28
- outputs=gr.Textbox(),
29
- examples=["audios/DF_E_2000027.flac", "audios/DF_E_2000031.flac"],
30
- cache_examples=False
31
- )
32
-
33
- # Tabbed interface
34
- app = gr.TabbedInterface(
35
- interface_list=[image_interface, video_interface, audio_interface],
36
- tab_names=['Image inference', 'Video inference', 'Audio inference']
37
- )
38
-
39
- # Launch
40
- if __name__ == "__main__":
41
- app.launch()
 
1
  import gradio as gr
2
  import inference_2 as inference
3
 
4
+
5
+ title="Multimodal deepfake detector"
6
+ description="Deepfake detection for videos, images and audio modalities."
7
+
8
+
9
+ video_interface = gr.Interface(inference.deepfakes_video_predict,
10
+ gr.Video(),
11
+ "text",
12
+ cache_examples = False
13
+ )
14
+
15
+
16
+ image_interface = gr.Interface(inference.deepfakes_image_predict,
17
+ gr.Image(),
18
+ "text",
19
+ examples = ["images/lady.jpg", "images/fake_image.jpg"],
20
+ cache_examples=False
21
+ )
22
+
23
+ audio_interface = gr.Interface(inference.deepfakes_spec_predict,
24
+ gr.Audio(),
25
+ "text",
26
+ examples = ["audios/DF_E_2000027.flac", "audios/DF_E_2000031.flac"],
27
+ cache_examples = False)
28
+
29
+
30
+ app = gr.TabbedInterface(interface_list= [image_interface, video_interface, audio_interface],
31
+ tab_names = ['Image inference', 'Video inference', 'Audio inference'])
32
+
33
+ if __name__ == '__main__':
34
+ app.launch(share = True)