Teapack1 commited on
Commit
8a9e88a
1 Parent(s): 2d5ec9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -8,7 +8,6 @@ pipe = pipeline("audio-classification", model=model_id)
8
  title = "Keyword Spotting Wav2Vec2"
9
  description = "Gradio demo for finetuned Wav2Vec2 model on a custom dataset to perform keyword spotting task. Classes are scene 1, scene 2, scene 3, yes, no and stop."
10
 
11
-
12
  def classify_audio(filepath):
13
  preds = pipe(filepath)
14
  outputs = {}
@@ -17,7 +16,22 @@ def classify_audio(filepath):
17
  return outputs
18
 
19
 
20
- demo = gr.Interface(
21
- fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.outputs.Label()
 
 
 
 
22
  )
23
- demo.launch(debug=True, share=True)
 
 
 
 
 
 
 
 
 
 
 
 
8
  title = "Keyword Spotting Wav2Vec2"
9
  description = "Gradio demo for finetuned Wav2Vec2 model on a custom dataset to perform keyword spotting task. Classes are scene 1, scene 2, scene 3, yes, no and stop."
10
 
 
11
  def classify_audio(filepath):
12
  preds = pipe(filepath)
13
  outputs = {}
 
16
  return outputs
17
 
18
 
19
+ demo = gr.Blocks()
20
+
21
+ mic_transcribe = gr.Interface(
22
+ fn=classify_audio,
23
+ inputs=gr.Audio(sources="microphone", type="filepath"),
24
+ outputs=gr.outputs.Label()
25
  )
26
+
27
+ mic_transcribe = gr.Interface(
28
+ fn=classify_audio,
29
+ inputs=gr.Audio(sources="upload", type="filepath"),
30
+ outputs=gr.outputs.Label()
31
+ )
32
+
33
+ with demo:
34
+ gr.TabbedInterface(
35
+ [mic_transcribe, file_transcribe],
36
+ ["Transcribe Microphone", "Transcribe Audio File"],
37
+ )