Mattral commited on
Commit
8b4a2fa
Β·
verified Β·
1 Parent(s): c051980

Update pages/2_πŸš€_QuickML.py

Browse files
Files changed (1) hide show
  1. pages/2_πŸš€_QuickML.py +15 -1
pages/2_πŸš€_QuickML.py CHANGED
@@ -72,12 +72,26 @@ if uploaded_file:
72
 
73
  # Read the CSV File
74
  if st.session_state.df is None:
75
- df = pd.read_csv(uploaded_file)
 
 
 
 
 
 
76
  else:
77
  df = st.session_state.df
78
  # st.dataframe(df)
79
  new_line()
80
 
 
 
 
 
 
 
 
 
81
  # The Dataset
82
  st.subheader("🎬 Dataset", anchor=False)
83
  new_line()
 
72
 
73
  # Read the CSV File
74
  if st.session_state.df is None:
75
+ # Read CSV or Excel file
76
+ if file.name.endswith('.csv'):
77
+ return pd.read_csv(file)
78
+ elif file.name.endswith('.xlsx') or file.name.endswith('.xls'):
79
+ return pd.read_excel(file)
80
+ else:
81
+ raise ValueError("Unsupported file format. Only CSV and Excel files are supported.")
82
  else:
83
  df = st.session_state.df
84
  # st.dataframe(df)
85
  new_line()
86
 
87
+ # Read CSV or Excel file
88
+ if file.name.endswith('.csv'):
89
+ return pd.read_csv(file)
90
+ elif file.name.endswith('.xlsx') or file.name.endswith('.xls'):
91
+ return pd.read_excel(file)
92
+ else:
93
+ raise ValueError("Unsupported file format. Only CSV and Excel files are supported.")
94
+
95
  # The Dataset
96
  st.subheader("🎬 Dataset", anchor=False)
97
  new_line()