File size: 573 Bytes
38c2fb5
fc5dd9a
c764f22
38c2fb5
461b2e6
38c2fb5
 
 
 
 
 
461b2e6
38c2fb5
fc5dd9a
38c2fb5
907d87a
 
 
6bbaf78
591a36f
c49b5d1
38c2fb5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from transformers import pipeline

model_id = "arham061/distilhubert-finetuned-PASCAL_Dataset_Augmented"
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'],
)

demo.launch(debug=True)