Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,34 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
|
|
|
7 |
st.set_page_config(page_title="TransPolymer", layout="wide", page_icon="π§ͺ")
|
8 |
|
9 |
-
#
|
10 |
st.sidebar.title("π Navigation")
|
11 |
-
page = st.sidebar.radio("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
# Routing logic
|
14 |
-
if page == "Home":
|
15 |
-
show_home()
|
16 |
-
elif page == "Prediction":
|
17 |
-
show_prediction()
|
18 |
-
elif page == "Contact Us":
|
19 |
-
show_contact()
|
20 |
-
elif page == "About":
|
21 |
-
show_about()
|
|
|
1 |
import streamlit as st
|
2 |
+
import home
|
3 |
+
import prediction
|
4 |
+
import about
|
5 |
+
import contact
|
6 |
|
7 |
+
# Set page config
|
8 |
st.set_page_config(page_title="TransPolymer", layout="wide", page_icon="π§ͺ")
|
9 |
|
10 |
+
# Navigation menu
|
11 |
st.sidebar.title("π Navigation")
|
12 |
+
page = st.sidebar.radio("Select a Page", ["Home", "Predictions", "About", "Contact"])
|
13 |
+
|
14 |
+
# Handle URL query params (e.g., ?page=Contact)
|
15 |
+
query_params = st.query_params
|
16 |
+
if "page" in query_params:
|
17 |
+
page = query_params["page"][0].capitalize() # Capitalize to match the radio button options
|
18 |
+
|
19 |
+
# Page routing logic
|
20 |
+
def load_page(page_name):
|
21 |
+
if page_name == "Home":
|
22 |
+
home.show()
|
23 |
+
elif page_name == "Predictions":
|
24 |
+
prediction.show()
|
25 |
+
elif page_name == "About":
|
26 |
+
about.show()
|
27 |
+
elif page_name == "Contact":
|
28 |
+
contact.show()
|
29 |
+
else:
|
30 |
+
st.error("Page not found")
|
31 |
+
|
32 |
+
# Load the selected page
|
33 |
+
load_page(page)
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|