Spaces:
Runtime error
Runtime error
from transformers import pipeline | |
import gradio as gr | |
model_id = "Teapack1/model_KWS" # update with your model id | |
pipe = pipeline("audio-classification", model=model_id) | |
title = "Keyword Spotting Wav2Vec2" | |
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." | |
def classify_audio(filepath): | |
preds = pipe(filepath) | |
outputs = {} | |
for p in preds: | |
outputs[p["label"]] = p["score"] | |
return outputs | |
demo = gr.Interface( | |
fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.outputs.Label() | |
) | |
demo.launch(debug=True) |