Spaces:
Sleeping
Sleeping
Commit
Β·
ba1c7a0
1
Parent(s):
d657219
Begin adding content
Browse files- app.py +1 -0
- media/about_header.svg +1 -0
- media/explore_header.svg +1 -0
- media/input_header.svg +1 -0
- media/validate_header.svg +1 -0
- menu.py +43 -1
- pages/about.py +17 -0
- pages/explore.py +5 -3
- pages/input.py +5 -3
- pages/user.py +0 -8
- pages/validate.py +5 -3
app.py
CHANGED
@@ -121,6 +121,7 @@ def check_password():
|
|
121 |
# Retrieve and store user name and team
|
122 |
st.session_state["name"] = user_db.loc[user_db.username == st.session_state["username"], "name"].values[0]
|
123 |
st.session_state["team"] = user_db.loc[user_db.username == st.session_state["username"], "team"].values[0]
|
|
|
124 |
|
125 |
# Don't store the username or password
|
126 |
del st.session_state["password"]
|
|
|
121 |
# Retrieve and store user name and team
|
122 |
st.session_state["name"] = user_db.loc[user_db.username == st.session_state["username"], "name"].values[0]
|
123 |
st.session_state["team"] = user_db.loc[user_db.username == st.session_state["username"], "team"].values[0]
|
124 |
+
st.session_state["profile_pic"] = user_db.loc[user_db.username == st.session_state["username"], "profile_pic"].values[0]
|
125 |
|
126 |
# Don't store the username or password
|
127 |
del st.session_state["password"]
|
media/about_header.svg
ADDED
|
media/explore_header.svg
ADDED
|
media/input_header.svg
ADDED
|
media/validate_header.svg
ADDED
|
menu.py
CHANGED
@@ -4,15 +4,57 @@ import streamlit as st
|
|
4 |
|
5 |
def authenticated_menu():
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# Show a navigation menu for authenticated users
|
8 |
# st.sidebar.page_link("app.py", label="Switch Accounts", icon="π")
|
9 |
-
st.sidebar.page_link("pages/
|
10 |
st.sidebar.page_link("pages/input.py", label="Input", icon="π‘")
|
11 |
st.sidebar.page_link("pages/validate.py", label="Validate", icon="β
")
|
12 |
st.sidebar.page_link("pages/explore.py", label="Explore", icon="π")
|
13 |
if st.session_state.role in ["admin"]:
|
14 |
st.sidebar.page_link("pages/admin.py", label="Manage Users", icon="π§")
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
def unauthenticated_menu():
|
18 |
|
|
|
4 |
|
5 |
def authenticated_menu():
|
6 |
|
7 |
+
st.markdown("""
|
8 |
+
<style>
|
9 |
+
.circle-image {
|
10 |
+
width: 100px;
|
11 |
+
height: 100px;
|
12 |
+
border-radius: 50%;
|
13 |
+
overflow: hidden;
|
14 |
+
display: flex;
|
15 |
+
justify-content: center;
|
16 |
+
align-items: center;
|
17 |
+
border: 2px solid black;
|
18 |
+
margin: 0 auto 10px auto;
|
19 |
+
}
|
20 |
+
|
21 |
+
.circle-image img {
|
22 |
+
width: 100%;
|
23 |
+
height: 100%;
|
24 |
+
object-fit: cover;
|
25 |
+
}
|
26 |
+
|
27 |
+
.username {
|
28 |
+
font-size: 20px;
|
29 |
+
font-weight: bold;
|
30 |
+
text-align: center;
|
31 |
+
margin-top: 0px;
|
32 |
+
}
|
33 |
+
</style>
|
34 |
+
""", unsafe_allow_html=True)
|
35 |
+
|
36 |
+
# Show the user's profile picture
|
37 |
+
st.sidebar.markdown(f'<div class="circle-image"><img src="{st.session_state.profile_pic}" /></div>', unsafe_allow_html=True)
|
38 |
+
|
39 |
+
# Show the user's name
|
40 |
+
# st.sidebar.markdown(f"Logged in as {st.session_state.name}.")
|
41 |
+
st.sidebar.markdown(f'<div class="username">{st.session_state.name}</div>', unsafe_allow_html=True)
|
42 |
+
st.sidebar.markdown("---")
|
43 |
+
|
44 |
# Show a navigation menu for authenticated users
|
45 |
# st.sidebar.page_link("app.py", label="Switch Accounts", icon="π")
|
46 |
+
st.sidebar.page_link("pages/about.py", label="About", icon="π")
|
47 |
st.sidebar.page_link("pages/input.py", label="Input", icon="π‘")
|
48 |
st.sidebar.page_link("pages/validate.py", label="Validate", icon="β
")
|
49 |
st.sidebar.page_link("pages/explore.py", label="Explore", icon="π")
|
50 |
if st.session_state.role in ["admin"]:
|
51 |
st.sidebar.page_link("pages/admin.py", label="Manage Users", icon="π§")
|
52 |
|
53 |
+
# Show the logout button
|
54 |
+
st.sidebar.markdown("---")
|
55 |
+
st.sidebar.button("Log Out", on_click=lambda: st.session_state.clear())
|
56 |
+
|
57 |
+
|
58 |
|
59 |
def unauthenticated_menu():
|
60 |
|
pages/about.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from menu import menu_with_redirect
|
3 |
+
|
4 |
+
# Path manipulation
|
5 |
+
from pathlib import Path
|
6 |
+
|
7 |
+
# Custom and other imports
|
8 |
+
import project_config
|
9 |
+
|
10 |
+
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
11 |
+
menu_with_redirect()
|
12 |
+
|
13 |
+
# Header
|
14 |
+
st.image(str(project_config.MEDIA_DIR / 'about_header.svg'), use_column_width=True)
|
15 |
+
|
16 |
+
# Main content
|
17 |
+
st.markdown(f"Hello, {st.session_state.name}! Welcome to GRAVITY, a GRaph AI VISualization Tool to query and visualize knowledge graph-grounded biomedical AI models.")
|
pages/explore.py
CHANGED
@@ -3,13 +3,15 @@ from menu import menu_with_redirect
|
|
3 |
|
4 |
# Path manipulation
|
5 |
from pathlib import Path
|
6 |
-
import sys
|
7 |
|
8 |
# Custom and other imports
|
9 |
import project_config
|
10 |
-
from utils import add_logo
|
11 |
|
12 |
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
13 |
menu_with_redirect()
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Path manipulation
|
5 |
from pathlib import Path
|
|
|
6 |
|
7 |
# Custom and other imports
|
8 |
import project_config
|
|
|
9 |
|
10 |
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
11 |
menu_with_redirect()
|
12 |
|
13 |
+
# Header
|
14 |
+
st.image(str(project_config.MEDIA_DIR / 'explore_header.svg'), use_column_width=True)
|
15 |
+
|
16 |
+
# Main content
|
17 |
+
st.markdown(f"Hello, {st.session_state.name}!")
|
pages/input.py
CHANGED
@@ -3,13 +3,15 @@ from menu import menu_with_redirect
|
|
3 |
|
4 |
# Path manipulation
|
5 |
from pathlib import Path
|
6 |
-
import sys
|
7 |
|
8 |
# Custom and other imports
|
9 |
import project_config
|
10 |
-
from utils import add_logo
|
11 |
|
12 |
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
13 |
menu_with_redirect()
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Path manipulation
|
5 |
from pathlib import Path
|
|
|
6 |
|
7 |
# Custom and other imports
|
8 |
import project_config
|
|
|
9 |
|
10 |
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
11 |
menu_with_redirect()
|
12 |
|
13 |
+
# Header
|
14 |
+
st.image(str(project_config.MEDIA_DIR / 'input_header.svg'), use_column_width=True)
|
15 |
+
|
16 |
+
# Main content
|
17 |
+
st.markdown(f"Hello, {st.session_state.name}!")
|
pages/user.py
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from menu import menu_with_redirect
|
3 |
-
|
4 |
-
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
5 |
-
menu_with_redirect()
|
6 |
-
|
7 |
-
st.title("Welcome to Gravity")
|
8 |
-
st.markdown(f"Hello, {st.session_state.name}!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/validate.py
CHANGED
@@ -3,13 +3,15 @@ from menu import menu_with_redirect
|
|
3 |
|
4 |
# Path manipulation
|
5 |
from pathlib import Path
|
6 |
-
import sys
|
7 |
|
8 |
# Custom and other imports
|
9 |
import project_config
|
10 |
-
from utils import add_logo
|
11 |
|
12 |
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
13 |
menu_with_redirect()
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Path manipulation
|
5 |
from pathlib import Path
|
|
|
6 |
|
7 |
# Custom and other imports
|
8 |
import project_config
|
|
|
9 |
|
10 |
# Redirect to app.py if not logged in, otherwise show the navigation menu
|
11 |
menu_with_redirect()
|
12 |
|
13 |
+
# Header
|
14 |
+
st.image(str(project_config.MEDIA_DIR / 'validate_header.svg'), use_column_width=True)
|
15 |
+
|
16 |
+
# Main content
|
17 |
+
st.markdown(f"Hello, {st.session_state.name}!")
|