Songs-Genre / app.py
Gyaneshere's picture
Update app.py
4e870cd verified
raw
history blame
426 Bytes
import gradio as gr
import pipeline
model_id = "Gyaneshere/distilhubert-finetuned-gtzan"
pipe = pipeline("audio-classification", model=model_id)
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.Label()
)
demo.launch(debug=True)