Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,40 +1,31 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
#
|
4 |
-
st.
|
5 |
-
|
6 |
-
# ✅ Then import your modules
|
7 |
-
import home
|
8 |
-
import prediction
|
9 |
-
import about
|
10 |
-
import contact
|
11 |
-
|
12 |
-
# ✅ Navigation Sidebar
|
13 |
-
st.sidebar.title("🔗 Navigation")
|
14 |
page = st.sidebar.radio("Select a Page", ["Home", "Predictions", "About", "Contact"])
|
15 |
|
16 |
-
#
|
17 |
-
query_params = st.query_params
|
18 |
-
if "page" in query_params:
|
19 |
-
param_page = query_params["page"][0].capitalize()
|
20 |
-
if param_page in ["Home", "Predictions", "About", "Contact"]:
|
21 |
-
page = param_page
|
22 |
-
|
23 |
-
# ✅ Page rendering logic
|
24 |
-
def load_page(page_name):
|
25 |
-
if page_name == "Home":
|
26 |
-
home.show()
|
27 |
-
elif page_name == "Predictions":
|
28 |
-
prediction.show()
|
29 |
-
elif page_name == "About":
|
30 |
-
about.show()
|
31 |
-
elif page_name == "Contact":
|
32 |
-
contact.show()
|
33 |
-
else:
|
34 |
-
st.error("Page not found.")
|
35 |
-
|
36 |
load_page(page)
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import home # Import home.py for the home page
|
3 |
+
import prediction # Import predictions.py for the predictions page
|
4 |
+
import about # Import about.py for the about page
|
5 |
+
import contact # Import contact.py for the contact page
|
6 |
+
|
7 |
+
# Set up navigation logic
|
8 |
+
def load_page(page):
|
9 |
+
if page == "Home":
|
10 |
+
home.show() # Call home.py's show() function
|
11 |
+
elif page == "Predictions":
|
12 |
+
prediction.show() # Call predictions.py's show() function
|
13 |
+
elif page == "About":
|
14 |
+
about.show() # Call about.py's show() function
|
15 |
+
elif page == "Contact":
|
16 |
+
contact.show() # Call contact.py's show() function
|
17 |
+
else:
|
18 |
+
st.error("Page not found")
|
19 |
|
20 |
+
# Navigation menu
|
21 |
+
st.sidebar.title("Navigation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
page = st.sidebar.radio("Select a Page", ["Home", "Predictions", "About", "Contact"])
|
23 |
|
24 |
+
# Call the function to display the selected page
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
load_page(page)
|
26 |
|
27 |
+
# Handle page URL updates
|
28 |
+
query_params = st.query_params
|
29 |
+
if "page" in query_params:
|
30 |
+
page = query_params["page"][0] # Get page value from URL parameters
|
31 |
+
load_page(page)
|