Spaces:
Sleeping
Sleeping
File size: 822 Bytes
d5de0c6 |
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 = ['/content/Trumpet_to_ambient_music.wav']
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()
|