Fola-lad commited on
Commit
2705bc4
Β·
1 Parent(s): 7057729

clean up UI

Browse files
Files changed (2) hide show
  1. .gitattributes +1 -1
  2. 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
- model.keras 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
+ .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("πŸƒ Human Activity Recognition")
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
- "⚠️ Model not yet available. "
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(["πŸ“‹ Select a Sample", "πŸ“ Upload Phyphox CSV"])
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("πŸ” Classify this sample", type="primary"):
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"{ACTIVITY_ICONS.get(pred_label, '')} **{pred_label}** "
152
- f"Β· {confidence:.1f}% confidence Β· βœ“ Correct"
153
  )
154
  else:
155
  st.error(
156
- f"{ACTIVITY_ICONS.get(pred_label, '')} **{pred_label}** "
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
- "πŸ“Œ Phyphox pipeline coming soon. "
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)