Sahil0605 commited on
Commit
f260205
·
1 Parent(s): dd9de15

first push

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +10 -10
src/streamlit_app.py CHANGED
@@ -9,21 +9,21 @@ from sklearn.neighbors import KNeighborsClassifier
9
  from sklearn.tree import DecisionTreeClassifier
10
  from sklearn.metrics import accuracy_score, r2_score
11
 
12
- # ====== Safe, relative folder paths ======
13
- UPLOAD_DIR = "uploads"
14
- PROCESSED_DIR = "processed"
15
- PKL_DIR = "pkl"
16
- ENCODERS_DIR = "encoders"
 
 
 
17
 
18
- # ====== Create directories if they don't exist ======
19
  for folder in [UPLOAD_DIR, PROCESSED_DIR, PKL_DIR, ENCODERS_DIR]:
20
  os.makedirs(folder, exist_ok=True)
21
 
22
  st.sidebar.title("Navigation")
23
- page = st.sidebar.selectbox(
24
- "Go to",
25
- ["Upload File", "Preprocess Data", "Train & Select Model", "Create App"]
26
- )
27
 
28
  # ========================
29
  # Upload File Page
 
9
  from sklearn.tree import DecisionTreeClassifier
10
  from sklearn.metrics import accuracy_score, r2_score
11
 
12
+ # ========================
13
+ # Directory Setup
14
+ # ========================
15
+ BASE_DIR = "/tmp" # Writable directory in hosted environments
16
+ UPLOAD_DIR = os.path.join(BASE_DIR, "uploads")
17
+ PROCESSED_DIR = os.path.join(BASE_DIR, "processed")
18
+ PKL_DIR = os.path.join(BASE_DIR, "pkl")
19
+ ENCODERS_DIR = os.path.join(BASE_DIR, "encoders")
20
 
21
+ # Create directories if they don't exist
22
  for folder in [UPLOAD_DIR, PROCESSED_DIR, PKL_DIR, ENCODERS_DIR]:
23
  os.makedirs(folder, exist_ok=True)
24
 
25
  st.sidebar.title("Navigation")
26
+ page = st.sidebar.selectbox("Go to", ["Upload File", "Preprocess Data", "Train & Select Model", "Create App"])
 
 
 
27
 
28
  # ========================
29
  # Upload File Page