arham061/HeartbeatAnomalies_Classification
2
1from transformers import pipeline2 3model_id = "arham061/distilhubert-finetuned-PASCAL_Dataset_Augmented"4pipe = pipeline("audio-classification", model=model_id)5 6def classify_audio(filepath):7 preds = pipe(filepath)8 outputs = {}9 for p in preds:10 outputs[p["label"]] = p["score"]11 return outputs12 13import gradio as gr14 15demo = gr.Interface(16 fn=classify_audio, 17 inputs=gr.Audio(type="filepath"), 18 outputs="label", 19 examples = ['normal.wav', 'murmur.wav', 'extra_systole.wav', 'extra_hystole.wav', 'artifact.wav'],20)21 22demo.launch(debug=True)