ayushnoori commited on
Commit
63ce440
·
1 Parent(s): 9005b8e

Catch PFP not found error

Browse files
Files changed (2) hide show
  1. media/pfp/gravity.png +3 -0
  2. menu.py +5 -1
media/pfp/gravity.png ADDED

Git LFS Details

  • SHA256: 348a8c9cabd92f92e0e088f24c7ddb10120911c3c492f8e91baf02a870d464fd
  • Pointer size: 131 Bytes
  • Size of remote file: 114 kB
menu.py CHANGED
@@ -1,11 +1,15 @@
1
  # From https://docs.streamlit.io/develop/tutorials/multipage/st.page_link-nav
2
  import streamlit as st
 
3
  import project_config
4
 
5
  def authenticated_menu():
6
 
7
  # Insert profile picture
8
- st.sidebar.image(str(project_config.MEDIA_DIR / 'pfp' / f"{st.session_state.profile_pic}.png"), use_column_width=True)
 
 
 
9
  st.sidebar.markdown("---")
10
 
11
  # Show a navigation menu for authenticated users
 
1
  # From https://docs.streamlit.io/develop/tutorials/multipage/st.page_link-nav
2
  import streamlit as st
3
+ import os
4
  import project_config
5
 
6
  def authenticated_menu():
7
 
8
  # Insert profile picture
9
+ pfp_path = str(project_config.MEDIA_DIR / 'pfp' / f"{st.session_state.profile_pic}.png")
10
+ if not os.path.exists(pfp_path):
11
+ pfp_path = str(project_config.MEDIA_DIR / 'pfp' / "gravity.png")
12
+ st.sidebar.image(pfp_path, use_column_width=True)
13
  st.sidebar.markdown("---")
14
 
15
  # Show a navigation menu for authenticated users