devjas1 commited on
Commit
95c5f93
·
1 Parent(s): c58845b

REFACTOR(arch): Transition to multi-page Streamlit app

Browse files

Refactored the application architecture from a single monolithic script
into a multi-page structure, adhering to Streamlit best practices.

- Renamed the main `app.py` to `1_🔬_Upload_and_Run.py` to serve as the
primary landing and inference page.
- This structural change enables the creation of dedicated pages for
specialized functionality, such as the new analysis dashboard,
improving code organization and user navigation.

Files changed (1) hide show
  1. 1_Upload_and_Run.py +41 -0
1_Upload_and_Run.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Streamlit main entrance; modularized for clarity"""
2
+
3
+ import streamlit as st
4
+
5
+ from modules.callbacks import init_session_state
6
+
7
+ from modules.ui_components import (
8
+ render_sidebar,
9
+ render_results_column,
10
+ render_input_column,
11
+ load_css,
12
+ )
13
+
14
+
15
+ # --- Page Setup (Called only ONCE) ---
16
+ st.set_page_config(
17
+ page_title="ML Polymer Classification",
18
+ page_icon="🔬",
19
+ layout="wide",
20
+ initial_sidebar_state="expanded",
21
+ menu_items={"Get help": "https://github.com/KLab-AI3/ml-polymer-recycling"},
22
+ )
23
+
24
+
25
+ def main():
26
+ """Modularized main content to other scripts to clean the main app"""
27
+ load_css("static/style.css")
28
+ init_session_state()
29
+
30
+ # Render UI components
31
+ render_sidebar()
32
+
33
+ col1, col2 = st.columns([1, 1.35], gap="small")
34
+ with col1:
35
+ render_input_column()
36
+ with col2:
37
+ render_results_column()
38
+
39
+
40
+ if __name__ == "__main__":
41
+ main()