Jules Sintes
init
8d60679
raw
history blame contribute delete
440 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline('audio-classification',model = "yojul/wav2vec2-base-one-shot-hip-hop-drums-clf")
def inference(file_path):
results = pipe(file_path)
return {x['label'] : x['score'] for x in results}
upl_audio = gr.Audio(sources="upload", type="filepath")
label = gr.Label(num_top_classes=5)
demo = gr.Interface(fn=inference, inputs=[upl_audio], outputs=[label])
demo.launch()