Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -215,7 +215,7 @@ if st.session_state.analysis is None:
|
|
| 215 |
'Calories': [2100, 2300, 1950],
|
| 216 |
'Sleep Duration': [7.5, 8.0, 6.5]
|
| 217 |
})
|
| 218 |
-
st.dataframe(sample_data,
|
| 219 |
|
| 220 |
else:
|
| 221 |
analysis = st.session_state.analysis
|
|
@@ -280,7 +280,7 @@ else:
|
|
| 280 |
}
|
| 281 |
))
|
| 282 |
fig_gauge.update_layout(height=200, margin=dict(l=0, r=0, t=0, b=0))
|
| 283 |
-
st.plotly_chart(fig_gauge,
|
| 284 |
|
| 285 |
st.markdown("---")
|
| 286 |
|
|
@@ -313,7 +313,7 @@ else:
|
|
| 313 |
st.caption("Download full CSV for detailed review.")
|
| 314 |
|
| 315 |
st.markdown("---")
|
| 316 |
-
|
| 317 |
# Future Self Motivation
|
| 318 |
st.header("π Design Your Future Self")
|
| 319 |
target = {
|
|
@@ -334,9 +334,9 @@ else:
|
|
| 334 |
f"- Stress score target: **{target['stress']:.2f}** (Low)\n"
|
| 335 |
)
|
| 336 |
encouragement = [
|
| 337 |
-
|
| 338 |
-
"
|
| 339 |
-
"
|
| 340 |
]
|
| 341 |
st.success(encouragement[len(analysis.records) % len(encouragement)])
|
| 342 |
|
|
@@ -393,7 +393,7 @@ else:
|
|
| 393 |
markers=True
|
| 394 |
)
|
| 395 |
fig_steps.update_layout(height=300)
|
| 396 |
-
st.plotly_chart(fig_steps,
|
| 397 |
|
| 398 |
with col2:
|
| 399 |
fig_hr = px.line(
|
|
@@ -405,7 +405,7 @@ else:
|
|
| 405 |
color_discrete_sequence=['red']
|
| 406 |
)
|
| 407 |
fig_hr.update_layout(height=300)
|
| 408 |
-
st.plotly_chart(fig_hr,
|
| 409 |
|
| 410 |
col1, col2 = st.columns(2)
|
| 411 |
|
|
@@ -419,7 +419,7 @@ else:
|
|
| 419 |
color_continuous_scale='Blues'
|
| 420 |
)
|
| 421 |
fig_calories.update_layout(height=300)
|
| 422 |
-
st.plotly_chart(fig_calories,
|
| 423 |
|
| 424 |
with col2:
|
| 425 |
fig_sleep = px.bar(
|
|
@@ -431,7 +431,7 @@ else:
|
|
| 431 |
color_continuous_scale='Purples'
|
| 432 |
)
|
| 433 |
fig_sleep.update_layout(height=300)
|
| 434 |
-
st.plotly_chart(fig_sleep,
|
| 435 |
|
| 436 |
st.subheader("π Deeper Insights")
|
| 437 |
col_a, col_b = st.columns(2)
|
|
@@ -445,7 +445,7 @@ else:
|
|
| 445 |
color_discrete_sequence=px.colors.sequential.Blues
|
| 446 |
)
|
| 447 |
fig_zone.update_layout(height=340)
|
| 448 |
-
st.plotly_chart(fig_zone,
|
| 449 |
|
| 450 |
with col_b:
|
| 451 |
fig_corr = px.scatter(
|
|
@@ -458,7 +458,7 @@ else:
|
|
| 458 |
color_continuous_scale="Viridis"
|
| 459 |
)
|
| 460 |
fig_corr.update_layout(height=340)
|
| 461 |
-
st.plotly_chart(fig_corr,
|
| 462 |
|
| 463 |
st.markdown("---")
|
| 464 |
|
|
@@ -540,7 +540,7 @@ else:
|
|
| 540 |
|
| 541 |
# Data Table
|
| 542 |
st.header("π Detailed Data")
|
| 543 |
-
st.dataframe(records_df,
|
| 544 |
|
| 545 |
# Download button
|
| 546 |
csv = records_df.to_csv(index=False)
|
|
@@ -549,4 +549,4 @@ else:
|
|
| 549 |
data=csv,
|
| 550 |
file_name=f"health_analysis_{datetime.now().strftime('%Y%m%d')}.csv",
|
| 551 |
mime="text/csv"
|
| 552 |
-
)
|
|
|
|
| 215 |
'Calories': [2100, 2300, 1950],
|
| 216 |
'Sleep Duration': [7.5, 8.0, 6.5]
|
| 217 |
})
|
| 218 |
+
st.dataframe(sample_data, width="stretch")
|
| 219 |
|
| 220 |
else:
|
| 221 |
analysis = st.session_state.analysis
|
|
|
|
| 280 |
}
|
| 281 |
))
|
| 282 |
fig_gauge.update_layout(height=200, margin=dict(l=0, r=0, t=0, b=0))
|
| 283 |
+
st.plotly_chart(fig_gauge, width="stretch")
|
| 284 |
|
| 285 |
st.markdown("---")
|
| 286 |
|
|
|
|
| 313 |
st.caption("Download full CSV for detailed review.")
|
| 314 |
|
| 315 |
st.markdown("---")
|
| 316 |
+
|
| 317 |
# Future Self Motivation
|
| 318 |
st.header("π Design Your Future Self")
|
| 319 |
target = {
|
|
|
|
| 334 |
f"- Stress score target: **{target['stress']:.2f}** (Low)\n"
|
| 335 |
)
|
| 336 |
encouragement = [
|
| 337 |
+
'Future You says: "Keep compounding the small wins."',
|
| 338 |
+
"Today's recovery is tomorrow's performance.",
|
| 339 |
+
"You're 1% closer every consistent day."
|
| 340 |
]
|
| 341 |
st.success(encouragement[len(analysis.records) % len(encouragement)])
|
| 342 |
|
|
|
|
| 393 |
markers=True
|
| 394 |
)
|
| 395 |
fig_steps.update_layout(height=300)
|
| 396 |
+
st.plotly_chart(fig_steps, width="stretch")
|
| 397 |
|
| 398 |
with col2:
|
| 399 |
fig_hr = px.line(
|
|
|
|
| 405 |
color_discrete_sequence=['red']
|
| 406 |
)
|
| 407 |
fig_hr.update_layout(height=300)
|
| 408 |
+
st.plotly_chart(fig_hr, width="stretch")
|
| 409 |
|
| 410 |
col1, col2 = st.columns(2)
|
| 411 |
|
|
|
|
| 419 |
color_continuous_scale='Blues'
|
| 420 |
)
|
| 421 |
fig_calories.update_layout(height=300)
|
| 422 |
+
st.plotly_chart(fig_calories, width="stretch")
|
| 423 |
|
| 424 |
with col2:
|
| 425 |
fig_sleep = px.bar(
|
|
|
|
| 431 |
color_continuous_scale='Purples'
|
| 432 |
)
|
| 433 |
fig_sleep.update_layout(height=300)
|
| 434 |
+
st.plotly_chart(fig_sleep, width="stretch")
|
| 435 |
|
| 436 |
st.subheader("π Deeper Insights")
|
| 437 |
col_a, col_b = st.columns(2)
|
|
|
|
| 445 |
color_discrete_sequence=px.colors.sequential.Blues
|
| 446 |
)
|
| 447 |
fig_zone.update_layout(height=340)
|
| 448 |
+
st.plotly_chart(fig_zone, width="stretch")
|
| 449 |
|
| 450 |
with col_b:
|
| 451 |
fig_corr = px.scatter(
|
|
|
|
| 458 |
color_continuous_scale="Viridis"
|
| 459 |
)
|
| 460 |
fig_corr.update_layout(height=340)
|
| 461 |
+
st.plotly_chart(fig_corr, width="stretch")
|
| 462 |
|
| 463 |
st.markdown("---")
|
| 464 |
|
|
|
|
| 540 |
|
| 541 |
# Data Table
|
| 542 |
st.header("π Detailed Data")
|
| 543 |
+
st.dataframe(records_df, width="stretch", height=400)
|
| 544 |
|
| 545 |
# Download button
|
| 546 |
csv = records_df.to_csv(index=False)
|
|
|
|
| 549 |
data=csv,
|
| 550 |
file_name=f"health_analysis_{datetime.now().strftime('%Y%m%d')}.csv",
|
| 551 |
mime="text/csv"
|
| 552 |
+
)
|