Spaces:
Sleeping
Sleeping
mistermprah
commited on
Commit
•
29a34ed
1
Parent(s):
40ddd7b
Upload 7 files
Browse files- app.py +22 -0
- artifact.wav +0 -0
- extra_hystole.wav +0 -0
- extra_systole.wav +0 -0
- murmur.wav +0 -0
- normal.wav +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
model_id = "arham061/distilhubert-finetuned-PASCAL_Dataset_Augmented"
|
4 |
+
pipe = pipeline("audio-classification", model=model_id)
|
5 |
+
|
6 |
+
def classify_audio(filepath):
|
7 |
+
preds = pipe(filepath)
|
8 |
+
outputs = {}
|
9 |
+
for p in preds:
|
10 |
+
outputs[p["label"]] = p["score"]
|
11 |
+
return outputs
|
12 |
+
|
13 |
+
import gradio as gr
|
14 |
+
|
15 |
+
demo = 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 |
+
|
22 |
+
demo.launch(debug=True)
|
artifact.wav
ADDED
Binary file (794 kB). View file
|
|
extra_hystole.wav
ADDED
Binary file (794 kB). View file
|
|
extra_systole.wav
ADDED
Binary file (47.9 kB). View file
|
|
murmur.wav
ADDED
Binary file (42.4 kB). View file
|
|
normal.wav
ADDED
Binary file (36.7 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
torch
|
3 |
+
transformers
|