destiratnakomala commited on
Commit
8a9febf
·
verified ·
1 Parent(s): 6aefed6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -16,12 +16,18 @@ def main():
16
  st.set_page_config(page_title="Data Automation-Machine Learning")
17
  st.title("Machine Learning")
18
 
19
- uploaded_file = None
20
- data = None
21
-
22
- # Step 1: Upload Data
23
  with st.expander("1: Add Your Data Source"):
24
  uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"])
 
 
 
 
 
 
 
 
 
 
25
 
26
  with st.expander("2: DataSet Preview"):
27
  if uploaded_file is not None:
 
16
  st.set_page_config(page_title="Data Automation-Machine Learning")
17
  st.title("Machine Learning")
18
 
 
 
 
 
19
  with st.expander("1: Add Your Data Source"):
20
  uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"])
21
+
22
+ # If no file is uploaded, load example.csv
23
+ if uploaded_file is None:
24
+ try:
25
+ data = pd.read_csv('example.csv') # Load example CSV
26
+ st.info("Loaded example.csv")
27
+ except FileNotFoundError:
28
+ st.error("Example CSV file not found. Please upload your own CSV file.")
29
+ else:
30
+ data = pd.read_csv(uploaded_file)
31
 
32
  with st.expander("2: DataSet Preview"):
33
  if uploaded_file is not None: