Spaces:
Sleeping
Sleeping
mistermprah
commited on
Commit
•
e273c59
1
Parent(s):
45a05ea
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,98 @@ def classify_audio(filepath):
|
|
28 |
# Streamlit app layout
|
29 |
st.title("Heartbeat Sound Classification")
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# File uploader for audio files
|
32 |
uploaded_file = st.file_uploader("Upload an audio file", type=["wav", "mp3"])
|
33 |
|
|
|
28 |
# Streamlit app layout
|
29 |
st.title("Heartbeat Sound Classification")
|
30 |
|
31 |
+
# Theme selection
|
32 |
+
theme = st.sidebar.selectbox(
|
33 |
+
"Select Theme",
|
34 |
+
["Light Green", "Light Blue", "Dark Green", "Dark Blue"]
|
35 |
+
)
|
36 |
+
|
37 |
+
# Add custom CSS for styling based on the selected theme
|
38 |
+
if theme == "Light Green":
|
39 |
+
st.markdown(
|
40 |
+
"""
|
41 |
+
<style>
|
42 |
+
body, .stApp {
|
43 |
+
background-color: #e8f5e9; /* Light green background */
|
44 |
+
}
|
45 |
+
.stApp {
|
46 |
+
color: #004d40; /* Dark green text */
|
47 |
+
}
|
48 |
+
.stButton > button, .stFileUpload > div {
|
49 |
+
background-color: #004d40; /* Dark green button and file uploader background */
|
50 |
+
color: white; /* White text */
|
51 |
+
}
|
52 |
+
.stButton > button:hover, .stFileUpload > div:hover {
|
53 |
+
background-color: #00332c; /* Darker green on hover */
|
54 |
+
}
|
55 |
+
</style>
|
56 |
+
""",
|
57 |
+
unsafe_allow_html=True
|
58 |
+
)
|
59 |
+
elif theme == "Light Blue":
|
60 |
+
st.markdown(
|
61 |
+
"""
|
62 |
+
<style>
|
63 |
+
body, .stApp {
|
64 |
+
background-color: #e0f7fa; /* Light blue background */
|
65 |
+
}
|
66 |
+
.stApp {
|
67 |
+
color: #006064; /* Dark blue text */
|
68 |
+
}
|
69 |
+
.stButton > button, .stFileUpload > div {
|
70 |
+
background-color: #006064; /* Dark blue button and file uploader background */
|
71 |
+
color: white; /* White text */
|
72 |
+
}
|
73 |
+
.stButton > button:hover, .stFileUpload > div:hover {
|
74 |
+
background-color: #004d40; /* Darker blue on hover */
|
75 |
+
}
|
76 |
+
</style>
|
77 |
+
""",
|
78 |
+
unsafe_allow_html=True
|
79 |
+
)
|
80 |
+
elif theme == "Dark Green":
|
81 |
+
st.markdown(
|
82 |
+
"""
|
83 |
+
<style>
|
84 |
+
body, .stApp {
|
85 |
+
background-color: #1b5e20; /* Dark green background */
|
86 |
+
}
|
87 |
+
.stApp {
|
88 |
+
color: #a5d6a7; /* Light green text */
|
89 |
+
}
|
90 |
+
.stButton > button, .stFileUpload > div {
|
91 |
+
background-color: #004d40; /* Dark green button and file uploader background */
|
92 |
+
color: white; /* White text */
|
93 |
+
}
|
94 |
+
.stButton > button:hover, .stFileUpload > div:hover {
|
95 |
+
background-color: #00332c; /* Darker green on hover */
|
96 |
+
}
|
97 |
+
</style>
|
98 |
+
""",
|
99 |
+
unsafe_allow_html=True
|
100 |
+
)
|
101 |
+
elif theme == "Dark Blue":
|
102 |
+
st.markdown(
|
103 |
+
"""
|
104 |
+
<style>
|
105 |
+
body, .stApp {
|
106 |
+
background-color: #0d47a1; /* Dark blue background */
|
107 |
+
}
|
108 |
+
.stApp {
|
109 |
+
color: #bbdefb; /* Light blue text */
|
110 |
+
}
|
111 |
+
.stButton > button, .stFileUpload > div {
|
112 |
+
background-color: #006064; /* Dark blue button and file uploader background */
|
113 |
+
color: white; /* White text */
|
114 |
+
}
|
115 |
+
.stButton > button:hover, .stFileUpload > div:hover {
|
116 |
+
background-color: #004d40; /* Darker blue on hover */
|
117 |
+
}
|
118 |
+
</style>
|
119 |
+
""",
|
120 |
+
unsafe_allow_html=True
|
121 |
+
)
|
122 |
+
|
123 |
# File uploader for audio files
|
124 |
uploaded_file = st.file_uploader("Upload an audio file", type=["wav", "mp3"])
|
125 |
|