File size: 411 Bytes
9880be2
0924371
9880be2
0924371
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline

pipe = pipeline("audio-classification",
                model="0xb1/wav2vec2-base-finetuned-speech_commands-v0.02")

def predict(audio_path):
    return pipe(audio_path)[0]["label"]

demo = gr.Interface(
    title='Fast audio commands recognition',
    fn=predict,
    inputs=gr.Audio(source="upload", type='filepath'),
    outputs='text',
)

demo.launch()