import gradio as gr from transformers import pipeline # Load model classifier = pipeline("audio-classification", model="yourusername/keyword-spotting-model") def predict(audio): preds = classifier(audio) return {p["label"]: p["score"] for p in preds} # Gradio UI gr.Interface( fn=predict, inputs=gr.Audio(source="microphone", type="filepath"), outputs=gr.Label(num_top_classes=3), title="🔊 Keyword Spotting", examples=["example1.wav", "example2.wav"] ).launch()