Spaces:
Sleeping
Sleeping
mistermprah
commited on
Commit
•
faac171
1
Parent(s):
b8c55dd
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,13 @@ pipe = pipeline("audio-classification", model=MODEL_ID)
|
|
7 |
|
8 |
def classify_audio(filepath):
|
9 |
preds = pipe(filepath)
|
10 |
-
outputs = {}
|
11 |
for p in preds:
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
return outputs
|
14 |
|
15 |
# Streamlit app layout
|
|
|
7 |
|
8 |
def classify_audio(filepath):
|
9 |
preds = pipe(filepath)
|
10 |
+
outputs = {"normal": 0.0, "murmur": 0.0, "artifact": 0.0}
|
11 |
for p in preds:
|
12 |
+
label = p["label"].replace('_', ' ')
|
13 |
+
if label in outputs:
|
14 |
+
outputs[label] += p["score"]
|
15 |
+
else:
|
16 |
+
outputs["normal"] += p["score"]
|
17 |
return outputs
|
18 |
|
19 |
# Streamlit app layout
|