-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu_streamlit.py
51 lines (37 loc) · 1.93 KB
/
menu_streamlit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import streamlit as st
from utils_streamlit import *
if 'role' not in st.session_state :
st.session_state.role = 'patient'
def authenticated_menu():
# Show a navigation menu for authenticated users
st.sidebar.page_link("app_streamlit.py", label="질문하기")
#if st.session_state.status in ["text", "chat","response"]:
#if st.session_state.role in ['patient','admin'] :
# st.sidebar.page_link("pages/Q_helper_chat_number.py", label="질문 보완하기 (개수에 따라)")
if st.session_state.status in ["text", "chat","response"]:
if st.session_state.role in ['patient','admin'] :
st.sidebar.page_link("pages/Q_helper_chat_stopToken.py", label="질문 보완하기 (stop token)")
if st.session_state.status in ["text", "chat","response"]:
if st.session_state.role in ['doctor','admin'] :
st.sidebar.page_link("pages/A_helper.py", label="답변하기")
#st.sidebar.page_link("pages/admin.py", label="Manage users")
#st.sidebar.page_link("pages/super-admin.py",label="Manage admin access",disabled=st.session_state.role != "super-admin",)
def unauthenticated_menu():
# Show a navigation menu for unauthenticated users
st.sidebar.page_link("app_streamlit.py", label="질문하기")
def menu():
# Determine if a user is logged in or not, then show the correct
# navigation menu
with st.sidebar:
st.text('계정 모드')
st.button(st.session_state.role, on_click=toggle_role)
if "status" not in st.session_state or st.session_state.status is None:
unauthenticated_menu()
return
authenticated_menu()
def menu_with_redirect():
# Redirect users to the main page if not logged in, otherwise continue to
# render the navigation menu
#if "status" not in st.session_state or st.session_state.status is None:
#st.switch_page("app_streamlit.py")
menu()