Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit import session_state as sst
|
3 |
+
import asyncio
|
4 |
+
|
5 |
+
from pages import landing_page, model_inference_page
|
6 |
+
|
7 |
+
if "page" not in sst:
|
8 |
+
sst['page'] = 'landing_page'
|
9 |
+
|
10 |
+
def reset_sst():
|
11 |
+
for key in list(sst.keys()):
|
12 |
+
if key != "page":
|
13 |
+
sst.pop(key, None)
|
14 |
+
|
15 |
+
|
16 |
+
# Main function to handle navigation
|
17 |
+
async def main():
|
18 |
+
"""
|
19 |
+
Main function that handles the navigation logic based on the current page.
|
20 |
+
|
21 |
+
Returns:
|
22 |
+
None
|
23 |
+
"""
|
24 |
+
|
25 |
+
# Navigation logic
|
26 |
+
if sst["page"] == "landing_page":
|
27 |
+
reset_sst() # reset all session state variables before navigating to the landing page
|
28 |
+
await landing_page() # Call the landing page function
|
29 |
+
|
30 |
+
elif sst["page"] == "model_inference_page":
|
31 |
+
await model_inference_page() # Call the model inference page function
|
32 |
+
|
33 |
+
asyncio.run(main())
|