Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|