Hnin's picture
create app.y
dbeafa0 verified
raw
history blame
495 Bytes
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()