arham061's picture
Update app.py
907d87a
raw history blame
No virus
579 Bytes
from transformers import pipeline
model_id = "arham061/distilhubert-finetuned-RHD_Dataset"
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
import gradio as gr
demo = gr.Interface(
fn=classify_audio,
inputs=gr.Audio(type="filepath"),
outputs="label",
examples = ['normal.wav', 'murmur.wav', 'extra_systole.wav', 'extra_hystole.wav', 'artifact.wav'],
theme = "dark"
)
demo.launch(debug=True)