import gradio as gr from transformers import pipeline 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(audio): predictions = audio_classifier(audio) return predictions iface = gr.Interface( fn=classify_audio, inputs=gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio"), outputs=gr.outputs.Label(), title="Audio Classification Demo", description="A simple demo to classify audio using a Hugging Face model." ) iface.launch(debug=True, share=True)