-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
32 lines (28 loc) · 1.09 KB
/
app.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
import streamlit as st
import login
import text_to_image
# Create a navigation menu on the homepage
st.title("Welcome to Text-to-Image Generation App")
st.markdown("Choose an option:")
# Use radio buttons for navigation
selected_option = st.radio("Select an option", ["Home", "Login", "Text-to-Image Generation"])
# Check if the user is logged in
if "logged_in" not in st.session_state:
st.session_state.logged_in = False
# Check query parameters
query_params = st.experimental_get_query_params()
if "page" in query_params and query_params["page"][0] == "text_to_image":
selected_option = "Text-to-Image Generation"
# Display the selected page based on the user's choice
if selected_option == "Login":
login.show()
elif selected_option == "Home":
if st.session_state.logged_in:
st.success("You are logged in!")
else:
st.error("You must log in or sign up first.")
elif selected_option == "Text-to-Image Generation":
if st.session_state.logged_in:
text_to_image.show()
else:
st.error("You must log in or sign up first.")