mmhamdy's picture
add app
f671d96
raw
history blame contribute delete
447 Bytes
from transformers import pipeline
import gradio as gr
model_id = "mmhamdy/whisper-tiny-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.outputs.Label()
)
demo.launch(debug=True)