Spaces:
Runtime error
Runtime error
clean up UI
Browse files- .gitattributes +1 -1
- src/streamlit_app.py +10 -26
.gitattributes
CHANGED
|
@@ -33,4 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
-
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
.DS_Store
|
src/streamlit_app.py
CHANGED
|
@@ -13,15 +13,6 @@ LABEL_MAP = {
|
|
| 13 |
5: "LAYING",
|
| 14 |
}
|
| 15 |
|
| 16 |
-
ACTIVITY_ICONS = {
|
| 17 |
-
"LAYING": "ποΈ",
|
| 18 |
-
"SITTING": "πͺ",
|
| 19 |
-
"STANDING": "π§",
|
| 20 |
-
"WALKING": "πΆ",
|
| 21 |
-
"WALKING_DOWNSTAIRS": "β¬οΈ",
|
| 22 |
-
"WALKING_UPSTAIRS": "β¬οΈ",
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
EXPLANATIONS = {
|
| 26 |
"LAYING": "Minimal movement detected across all axes with low acceleration magnitude β consistent with a stationary horizontal posture.",
|
| 27 |
"SITTING": "Low dynamic acceleration with a stable gravity component suggests a stationary upright posture with little body movement.",
|
|
@@ -54,7 +45,7 @@ st.set_page_config(
|
|
| 54 |
layout="centered"
|
| 55 |
)
|
| 56 |
|
| 57 |
-
st.title("
|
| 58 |
st.markdown(
|
| 59 |
"Deep learning classifier trained on 561 smartphone sensor features "
|
| 60 |
"from the [UCI HAR dataset](https://www.kaggle.com/datasets/uciml/human-activity-recognition-with-smartphones). "
|
|
@@ -86,15 +77,14 @@ model, model_status = load_model()
|
|
| 86 |
|
| 87 |
if model_status == "no_model":
|
| 88 |
st.warning(
|
| 89 |
-
"
|
| 90 |
"The interface is fully built β predictions will activate once "
|
| 91 |
-
"`model.keras` is uploaded."
|
| 92 |
-
icon="β οΈ"
|
| 93 |
)
|
| 94 |
|
| 95 |
# ββ Tabs βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 96 |
|
| 97 |
-
tab1, tab2 = st.tabs(["
|
| 98 |
|
| 99 |
# ββ Tab 1: Sample selector βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 100 |
|
|
@@ -125,14 +115,11 @@ with tab1:
|
|
| 125 |
|
| 126 |
col1, col2 = st.columns(2)
|
| 127 |
with col1:
|
| 128 |
-
st.metric(
|
| 129 |
-
"True Activity",
|
| 130 |
-
f"{ACTIVITY_ICONS.get(true_label, '')} {true_label}"
|
| 131 |
-
)
|
| 132 |
with col2:
|
| 133 |
st.metric("Feature count", len(feature_vector))
|
| 134 |
|
| 135 |
-
if st.button("
|
| 136 |
if model_status == "no_model":
|
| 137 |
st.error("Model not loaded β cannot predict yet.")
|
| 138 |
else:
|
|
@@ -148,13 +135,11 @@ with tab1:
|
|
| 148 |
|
| 149 |
if correct:
|
| 150 |
st.success(
|
| 151 |
-
f"
|
| 152 |
-
f"Β· {confidence:.1f}% confidence Β· β Correct"
|
| 153 |
)
|
| 154 |
else:
|
| 155 |
st.error(
|
| 156 |
-
f"
|
| 157 |
-
f"Β· {confidence:.1f}% confidence Β· "
|
| 158 |
f"β Incorrect (true: {true_label})"
|
| 159 |
)
|
| 160 |
|
|
@@ -192,10 +177,9 @@ with tab2:
|
|
| 192 |
|
| 193 |
if uploaded_file is not None:
|
| 194 |
st.info(
|
| 195 |
-
"
|
| 196 |
"Feature extraction from raw sensor readings "
|
| 197 |
-
"(filtering β jerk β FFT β 561 features) is under development."
|
| 198 |
-
icon="π§"
|
| 199 |
)
|
| 200 |
try:
|
| 201 |
preview = pd.read_csv(uploaded_file)
|
|
|
|
| 13 |
5: "LAYING",
|
| 14 |
}
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
EXPLANATIONS = {
|
| 17 |
"LAYING": "Minimal movement detected across all axes with low acceleration magnitude β consistent with a stationary horizontal posture.",
|
| 18 |
"SITTING": "Low dynamic acceleration with a stable gravity component suggests a stationary upright posture with little body movement.",
|
|
|
|
| 45 |
layout="centered"
|
| 46 |
)
|
| 47 |
|
| 48 |
+
st.title("Human Activity Recognition")
|
| 49 |
st.markdown(
|
| 50 |
"Deep learning classifier trained on 561 smartphone sensor features "
|
| 51 |
"from the [UCI HAR dataset](https://www.kaggle.com/datasets/uciml/human-activity-recognition-with-smartphones). "
|
|
|
|
| 77 |
|
| 78 |
if model_status == "no_model":
|
| 79 |
st.warning(
|
| 80 |
+
"Model not yet available. "
|
| 81 |
"The interface is fully built β predictions will activate once "
|
| 82 |
+
"`model.keras` is uploaded."
|
|
|
|
| 83 |
)
|
| 84 |
|
| 85 |
# ββ Tabs βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 86 |
|
| 87 |
+
tab1, tab2 = st.tabs(["Select a Sample", "Upload Phyphox CSV"])
|
| 88 |
|
| 89 |
# ββ Tab 1: Sample selector βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 90 |
|
|
|
|
| 115 |
|
| 116 |
col1, col2 = st.columns(2)
|
| 117 |
with col1:
|
| 118 |
+
st.metric("True Activity", true_label)
|
|
|
|
|
|
|
|
|
|
| 119 |
with col2:
|
| 120 |
st.metric("Feature count", len(feature_vector))
|
| 121 |
|
| 122 |
+
if st.button("Classify this sample", type="primary"):
|
| 123 |
if model_status == "no_model":
|
| 124 |
st.error("Model not loaded β cannot predict yet.")
|
| 125 |
else:
|
|
|
|
| 135 |
|
| 136 |
if correct:
|
| 137 |
st.success(
|
| 138 |
+
f"**{pred_label}** Β· {confidence:.1f}% confidence Β· β Correct"
|
|
|
|
| 139 |
)
|
| 140 |
else:
|
| 141 |
st.error(
|
| 142 |
+
f"**{pred_label}** Β· {confidence:.1f}% confidence Β· "
|
|
|
|
| 143 |
f"β Incorrect (true: {true_label})"
|
| 144 |
)
|
| 145 |
|
|
|
|
| 177 |
|
| 178 |
if uploaded_file is not None:
|
| 179 |
st.info(
|
| 180 |
+
"Phyphox pipeline coming soon. "
|
| 181 |
"Feature extraction from raw sensor readings "
|
| 182 |
+
"(filtering β jerk β FFT β 561 features) is under development."
|
|
|
|
| 183 |
)
|
| 184 |
try:
|
| 185 |
preview = pd.read_csv(uploaded_file)
|