CosmickVisions commited on
Commit
5dfa301
·
verified ·
1 Parent(s): d1012c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -8
app.py CHANGED
@@ -407,6 +407,12 @@ elif app_mode == "Data Cleaning":
407
  st.warning("Please upload data first")
408
  st.stop() # Stop execution if no data uploaded
409
 
 
 
 
 
 
 
410
 
411
  # Data Health Dashboard
412
  enhance_section_title("Data Health Dashboard", "📊")
@@ -575,8 +581,11 @@ elif app_mode == "EDA":
575
  st.warning("Please upload data first")
576
  st.stop() # Stop execution if no data uploaded
577
 
578
- df = st.session_state.cleaned_data.copy() # Work on the latest cleaned data
579
- # Rest of the EDA code...
 
 
 
580
 
581
 
582
  # --------------------------
@@ -910,7 +919,12 @@ elif app_mode == "Model Training":
910
  st.warning("Please upload data first")
911
  st.stop() # Stop execution if no data uploaded
912
 
913
- df = st.session_state.cleaned_data.copy() # Work on the latest cleaned data
 
 
 
 
 
914
  # Rest of the model training code...
915
 
916
 
@@ -1093,12 +1107,21 @@ elif app_mode == "Model Training":
1093
  st.metric("R2", f"{validation_metrics['r2']:.2f}")
1094
 
1095
  # Predictions Section (Fixed)
1096
- if app_mode == "Predictions":
1097
- st.title("🔮 Predictive Analytics - Informed Business Decisions")
 
 
 
 
 
 
 
 
 
 
 
 
1098
 
1099
- if st.session_state.get("model") is None:
1100
- st.warning("Please train a model first")
1101
- st.stop()
1102
 
1103
  model_data = st.session_state.model # Get the entire dictionary
1104
  model = model_data['model'] # Access model
 
407
  st.warning("Please upload data first")
408
  st.stop() # Stop execution if no data uploaded
409
 
410
+ if 'cleaned_data' in st.session_state and st.session_state.cleaned_data is not None:
411
+ df = st.session_state.cleaned_data.copy() # Work on the latest cleaned data
412
+ else:
413
+ st.warning("No cleaned data available. Please clean your data first.")
414
+ st.stop() # Stop execution if no cleaned data is available
415
+
416
 
417
  # Data Health Dashboard
418
  enhance_section_title("Data Health Dashboard", "📊")
 
581
  st.warning("Please upload data first")
582
  st.stop() # Stop execution if no data uploaded
583
 
584
+ if 'cleaned_data' in st.session_state and st.session_state.cleaned_data is not None:
585
+ df = st.session_state.cleaned_data.copy() # Work on the latest cleaned data
586
+ else:
587
+ st.warning("No cleaned data available. Please clean your data first.")
588
+ st.stop()
589
 
590
 
591
  # --------------------------
 
919
  st.warning("Please upload data first")
920
  st.stop() # Stop execution if no data uploaded
921
 
922
+ if 'cleaned_data' in st.session_state and st.session_state.cleaned_data is not None:
923
+ df = st.session_state.cleaned_data.copy() # Work on the latest cleaned data
924
+ else:
925
+ st.warning("No cleaned data available. Please clean your data first.")
926
+ st.stop() # Stop execution if no cleaned data is available
927
+
928
  # Rest of the model training code...
929
 
930
 
 
1107
  st.metric("R2", f"{validation_metrics['r2']:.2f}")
1108
 
1109
  # Predictions Section (Fixed)
1110
+ elif app_mode == "Predictions":
1111
+ st.title("🔮 Predictive Analytics")
1112
+
1113
+ if st.session_state.raw_data is None:
1114
+ st.warning("Please upload data first")
1115
+ st.stop() # Stop execution if no data uploaded
1116
+
1117
+ if 'cleaned_data' in st.session_state and st.session_state.cleaned_data is not None:
1118
+ df = st.session_state.cleaned_data.copy() # Work on the latest cleaned data
1119
+ else:
1120
+ st.warning("No cleaned data available. Please clean your data first.")
1121
+ st.stop() # Stop execution if no cleaned data is available
1122
+
1123
+ # Rest of the predictions code...
1124
 
 
 
 
1125
 
1126
  model_data = st.session_state.model # Get the entire dictionary
1127
  model = model_data['model'] # Access model