CosmickVisions commited on
Commit
a828de5
·
verified ·
1 Parent(s): 2350d41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -0
app.py CHANGED
@@ -137,6 +137,53 @@ if 'model' not in st.session_state:
137
  if 'preprocessor' not in st.session_state:
138
  st.session_state.preprocessor = None # to store the column transformer
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  # --- Progress Bar ----
142
  def animated_progress_bar(progress_var, message="Processing..."):
 
137
  if 'preprocessor' not in st.session_state:
138
  st.session_state.preprocessor = None # to store the column transformer
139
 
140
+ # Initialize session state for uploaded data
141
+ if 'uploaded_data' not in st.session_state:
142
+ st.session_state.uploaded_data = None
143
+
144
+ # File Upload Section
145
+ uploaded_file = st.sidebar.file_uploader("Upload a CSV or Excel file", type=["csv", "xlsx"], help="Upload your dataset here. Supported formats: CSV, XLSX")
146
+ if uploaded_file is not None:
147
+ try:
148
+ df = pd.read_csv(uploaded_file)
149
+ st.session_state.cleaned_data = df
150
+ st.session_state.uploaded_data = df # Add to session state
151
+ st.success("Data loaded successfully!")
152
+ except Exception as e:
153
+ st.error(f"Error loading data: {e}")
154
+
155
+ # Sidebar Navigation
156
+ st.sidebar.title("🔮 Data Wizard Pro")
157
+
158
+ # Apply custom CSS to change text color in the sidebar
159
+ st.markdown(
160
+ """
161
+ <style>
162
+ [data-testid="stSidebar"] {
163
+ color: #00f7ff; /* Cyan color for sidebar text */
164
+ }
165
+ </style>
166
+ """,
167
+ unsafe_allow_html=True,
168
+ )
169
+
170
+ # Navigation and Page Logic
171
+ app_mode = st.sidebar.radio("Navigate", [
172
+ "Data Upload",
173
+ "Smart Cleaning",
174
+ "Advanced EDA",
175
+ "Model Training",
176
+ "Predictions",
177
+ "Visualization Lab",
178
+ "Neural Network Studio"
179
+ ])
180
+
181
+ # Access the cleaned data in your app's pages
182
+ if st.session_state.uploaded_data is not None:
183
+ df = st.session_state.uploaded_data.copy()
184
+ else:
185
+ st.warning("Please upload a CSV file.")
186
+
187
 
188
  # --- Progress Bar ----
189
  def animated_progress_bar(progress_var, message="Processing..."):