forked from BigDataIA-Fall2024-TeamA2/Assignment2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
79 lines (68 loc) · 1.99 KB
/
Copy pathapp.py
File metadata and controls
79 lines (68 loc) · 1.99 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import streamlit as st
from dotenv import load_dotenv
from frontend.pages.chat import qa_interface
from frontend.pages.user_creation import create_user
from frontend.pages.user_login import login
# Load environment variables from .env file
load_dotenv()
# Set page configuration
st.set_page_config(
page_title="Question Answering Interface",
layout="wide",
initial_sidebar_state="expanded",
)
# Custom CSS (unchanged)
st.markdown("""
<style>
.reportview-container {
background: linear-gradient(to right, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%);
}
.sidebar .sidebar-content {
background: linear-gradient(to bottom, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%);
}
h1 {
color: #1e3d59;
}
.stButton>button {
color: #ffffff;
background-color: #1e3d59;
border-radius: 5px;
}
.stTextInput>div>div>input {
border-radius: 5px;
}
</style>
""", unsafe_allow_html=True)
# PAGES = {
# "Home": home,
# "Login": login,
# "Register": None,
# "Chat": chat
# }
#
# st.sidebar.title("Navigation")
# selection = st.sidebar.selectbox("Go to", list(PAGES.keys()))
#
# page = PAGES[selection]
# page.main() # Changed from page.app() to page.main()
if "logged_in" not in st.session_state:
st.session_state.logged_in = False
def logout():
if st.button("Logout"):
st.session_state.logged_in = False
st.rerun()
login_page = st.Page(login, title="User Login", icon=":material/login:", default=True)
logout_page = st.Page(logout, title="Log Out", icon=":material/logout:")
user_creation_page = st.Page(create_user, title="User Registration")
qa_page = st.Page(qa_interface, title="Question Answering", icon=":material/chat:")
if st.session_state.logged_in:
pg = st.navigation({
"Question Answering Interface": [qa_page],
"Logout": [logout_page]
})
else:
pg = st.navigation({
"User Login": [login_page],
"User Creation": [user_creation_page],
})
pg.run()