bvallegc commited on
Commit
29c68df
·
1 Parent(s): 7fac348

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -12
app.py CHANGED
@@ -1,5 +1,5 @@
1
  from transformers import pipeline
2
- import gradio
3
  from gradio import Interface, Audio, Label, Number
4
 
5
  username = 'bvallegc' ## Complete your username
@@ -20,15 +20,24 @@ def classify_audio(filepath):
20
  number = classification[0]["score"]
21
  return label, number
22
 
23
- interface_options = {
24
- "title": "Spoofing Classification",
25
- "description": "The audio classifier for those who are the best and only want and require the best",
26
- # Audio from validation file
27
- "allow_flagging": "never"
28
-
29
- }
30
 
31
- demo = Interface(
32
- fn=classify_audio, inputs= Audio(type="filepath"), outputs=[Label(), Number()], examples=[["TTS_M_LA_E_7056254.wav", "TTS_M_LA_E_3371601.wav", "TTS_M_LA_E_7056254.wav"]], **interface_options
33
- )
34
- demo.launch(debug=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from transformers import pipeline
2
+ import gradio as gr
3
  from gradio import Interface, Audio, Label, Number
4
 
5
  username = 'bvallegc' ## Complete your username
 
20
  number = classification[0]["score"]
21
  return label, number
22
 
23
+ examples=['TTS_F_LA_E_7682468.wav', 'TTS_M_LA_E_3371601.wav', 'TTS_M_LA_E_7056254.wav']
24
+ examples = [[f"./{f}"] for f in examples]
 
 
 
 
 
25
 
26
+ gr.Interface(
27
+ inputs=[
28
+ gr.inputs.Audio(source="microphone", type='filepath', optional=True),
29
+ gr.inputs.Audio(source="upload", type='filepath', optional=True),
30
+ gr.Textbox(label="Paste audio here"),
31
+ ],
32
+
33
+ outputs=[
34
+ gr.outputs.Textbox(label="Verification"),
35
+ gr.Number(label="Probability"),
36
+ ],
37
+
38
+ verbose=True,
39
+ examples = examples,
40
+ title="Spoofing verification classifier",
41
+ description="Detect machine created audios from human-speech.",
42
+ theme="huggingface"
43
+ ).launch()