sunbal7 commited on
Commit
d682964
Β·
verified Β·
1 Parent(s): b7d2d05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -15
app.py CHANGED
@@ -62,6 +62,11 @@ st.markdown("""
62
  border-radius: 15px;
63
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
64
  }
 
 
 
 
 
65
  </style>
66
  """, unsafe_allow_html=True)
67
 
@@ -162,13 +167,26 @@ else:
162
  # Sidebar navigation
163
  with st.sidebar:
164
  st.title("🧭 Navigation")
165
- st.session_state.page = st.radio("Choose Section:", [
166
- "πŸ“‹ Personality Report",
167
- "πŸ“Š Visual Analysis",
168
- "πŸ“± Social Media Post",
169
- "πŸ’‘ Success Tips",
170
- "πŸ“₯ Download Report"
171
- ])
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  # Question flow
174
  if st.session_state.current_q < 5:
@@ -209,16 +227,21 @@ else:
209
 
210
  elif st.session_state.page == "πŸ“Š Visual Analysis":
211
  st.header("πŸ“Š Personality Visualization")
 
212
  radar_data = pd.DataFrame({
213
- "Trait": list(traits.keys()) * 2,
214
- "Score": list(traits.values()) * 2,
215
- "Type": ["Base"]*5 + ["Current"]*5
216
  })
217
- st.altair_chart(alt.Chart(radar_data).mark_line().encode(
218
- theta="Trait",
219
- r="Score",
220
- color="Type"
221
- ).project(type='radial'), use_container_width=True)
 
 
 
 
222
 
223
  elif st.session_state.page == "πŸ“± Social Media Post":
224
  st.header("πŸ“± Create Social Post")
 
62
  border-radius: 15px;
63
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
64
  }
65
+
66
+ .nav-btn {
67
+ margin: 8px 0;
68
+ width: 100%;
69
+ }
70
  </style>
71
  """, unsafe_allow_html=True)
72
 
 
167
  # Sidebar navigation
168
  with st.sidebar:
169
  st.title("🧭 Navigation")
170
+ st.markdown("---")
171
+ if st.button("πŸ“‹ Personality Report", key="btn1", use_container_width=True,
172
+ help="View your detailed personality analysis"):
173
+ st.session_state.page = "πŸ“‹ Personality Report"
174
+
175
+ if st.button("πŸ“Š Visual Analysis", key="btn2", use_container_width=True,
176
+ help="Explore visual representations of your personality"):
177
+ st.session_state.page = "πŸ“Š Visual Analysis"
178
+
179
+ if st.button("πŸ“± Social Media Post", key="btn3", use_container_width=True,
180
+ help="Generate personalized social media posts"):
181
+ st.session_state.page = "πŸ“± Social Media Post"
182
+
183
+ if st.button("πŸ’‘ Success Tips", key="btn4", use_container_width=True,
184
+ help="Discover personalized improvement tips"):
185
+ st.session_state.page = "πŸ’‘ Success Tips"
186
+
187
+ if st.button("πŸ“₯ Download Report", key="btn5", use_container_width=True,
188
+ help="Download your complete personality report"):
189
+ st.session_state.page = "πŸ“₯ Download Report"
190
 
191
  # Question flow
192
  if st.session_state.current_q < 5:
 
227
 
228
  elif st.session_state.page == "πŸ“Š Visual Analysis":
229
  st.header("πŸ“Š Personality Visualization")
230
+ # Fix radar chart encoding
231
  radar_data = pd.DataFrame({
232
+ "Trait": list(traits.keys()),
233
+ "Score": list(traits.values()),
234
+ "Angle": [i*(360/5) for i in range(5)]
235
  })
236
+
237
+ chart = alt.Chart(radar_data).mark_line(point=True).encode(
238
+ theta=alt.Theta("Angle:Q", stack=True),
239
+ radius=alt.Radius("Score:Q", scale=alt.Scale(type='linear', zero=True)),
240
+ color=alt.value("#4CAF50"),
241
+ tooltip=["Trait", "Score"]
242
+ ).project(type='radial')
243
+
244
+ st.altair_chart(chart, use_container_width=True)
245
 
246
  elif st.session_state.page == "πŸ“± Social Media Post":
247
  st.header("πŸ“± Create Social Post")