Spaces:
Sleeping
Sleeping
File size: 807 Bytes
d5de0c6 032c3b9 d5de0c6 b7c3c02 d5de0c6 64fd9eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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()
|