ceefax's picture
Update app.py
032c3b9
from transformers import pipeline
import gradio as gr
pipe = pipeline(
"audio-classification", model="ceefax/distilhubert-finetuned-gtzan"
)
model_id = "ceefax/distilhubert-finetuned-gtzan"
pipe = pipeline("audio-classification", model=model_id)
title = "Genre Classifier"
description = "Genre classifier trained on GTZAN"
examples = ['Fleshy.mp3', 'Kombucha.mp3']
interpretation='default'
enable_queue=True
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.outputs.Label(), title=title,description=description
,examples=examples
,interpretation=interpretation,enable_queue=enable_queue
).launch()