HenRick69 commited on
Commit
0924371
1 Parent(s): 8b19d08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -1,3 +1,17 @@
1
  import gradio as gr
 
2
 
3
- gr.Interface.load("models/0xb1/wav2vec2-base-finetuned-speech_commands-v0.02").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ pipe = pipeline("audio-classification",
5
+ model="0xb1/wav2vec2-base-finetuned-speech_commands-v0.02")
6
+
7
+ def predict(audio_path):
8
+ return pipe(audio_path)[0]["label"]
9
+
10
+ demo = gr.Interface(
11
+ title='Fast audio commands recognition',
12
+ fn=predict,
13
+ inputs=gr.Audio(source="upload", type='filepath'),
14
+ outputs='text',
15
+ )
16
+
17
+ demo.launch()