hp1318's picture
Update app.py
423e0fa verified
raw
history blame contribute delete
501 Bytes
from transformers import pipeline
import gradio as gr
model_id = 'hp1318/ast-finetuned-audioset-10-10-0.4593-finetuned-gtzan'
pipe = pipeline('audio-classification', model=model_id)
def classify_audio(filepath):
preds = pipe(filepath)
outputs = {p["label"]: p["score"] for p in preds}
return outputs
demo = gr.Interface(fn=classify_audio, inputs=gr.Audio(type="filepath"), outputs=gr.Label(),title="Music Genre Classifier",description="Classify music into different genres")
demo.launch()