Spaces:
Sleeping
Sleeping
mistermprah
commited on
Commit
•
bc6c98d
1
Parent(s):
a2fa92e
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ def classify_audio(filepath):
|
|
10 |
preds = pipe(filepath)
|
11 |
outputs = {}
|
12 |
for p in preds:
|
13 |
-
outputs[p["label"]] = p["score"]
|
14 |
return outputs
|
15 |
|
16 |
# Streamlit app layout
|
@@ -43,10 +43,11 @@ if uploaded_file is not None:
|
|
43 |
st.write("Examples:")
|
44 |
examples = ['normal.wav', 'murmur.wav', 'extra_systole.wav', 'extra_hystole.wav', 'artifact.wav']
|
45 |
for example in examples:
|
46 |
-
st.
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
10 |
preds = pipe(filepath)
|
11 |
outputs = {}
|
12 |
for p in preds:
|
13 |
+
outputs[p["label"].replace('_', ' ')] = p["score"]
|
14 |
return outputs
|
15 |
|
16 |
# Streamlit app layout
|
|
|
43 |
st.write("Examples:")
|
44 |
examples = ['normal.wav', 'murmur.wav', 'extra_systole.wav', 'extra_hystole.wav', 'artifact.wav']
|
45 |
for example in examples:
|
46 |
+
if st.button(example):
|
47 |
+
st.subheader(f"Example: {example}")
|
48 |
+
audio_bytes = open(example, 'rb').read()
|
49 |
+
st.audio(audio_bytes, format='audio/wav')
|
50 |
+
results = classify_audio(example)
|
51 |
+
st.write("Results:")
|
52 |
+
results_str = "\n".join([f"{label}: {score:.4f}" for label, score in results.items()])
|
53 |
+
st.text(results_str)
|