dperales commited on
Commit
3f3d080
·
1 Parent(s): 760e447

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -11
app.py CHANGED
@@ -52,9 +52,6 @@ if page == "Clustering Analysis":
52
  all_files = os.listdir(directory)
53
  # Filter files to only include CSV files
54
  csv_files = [file for file in all_files if file.endswith(".csv")]
55
- st.write("CSV files in the directory:")
56
- for file in csv_files:
57
- st.write(file)
58
 
59
  # Select a CSV file from the list
60
  selected_csv = st.selectbox("Select a CSV file from the list", ["None"] + csv_files)
@@ -135,7 +132,16 @@ elif page == "Anomaly Detection":
135
  # import AnomalyExperiment
136
  from pycaret.anomaly import AnomalyExperiment
137
 
138
- # Upload the CSV file
 
 
 
 
 
 
 
 
 
139
  uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
140
 
141
  # Define the unsupervised model
@@ -143,13 +149,16 @@ elif page == "Anomaly Detection":
143
  selected_model = st.selectbox("Choose an anomaly model", anomalymodel)
144
 
145
  # Read and display the CSV file
146
- if uploaded_file is not None:
147
- try:
148
- delimiter = ','
149
- insurance_claims = pd.read_csv (uploaded_file, sep=delimiter)
150
- except ValueError:
151
- delimiter = '|'
152
- insurance_claims = pd.read_csv (uploaded_file, sep=delimiter, encoding='latin-1')
 
 
 
153
 
154
  s = setup(insurance_claims, session_id = 123)
155
 
 
52
  all_files = os.listdir(directory)
53
  # Filter files to only include CSV files
54
  csv_files = [file for file in all_files if file.endswith(".csv")]
 
 
 
55
 
56
  # Select a CSV file from the list
57
  selected_csv = st.selectbox("Select a CSV file from the list", ["None"] + csv_files)
 
132
  # import AnomalyExperiment
133
  from pycaret.anomaly import AnomalyExperiment
134
 
135
+ # Display the list of CSV files
136
+ directory = "./"
137
+ all_files = os.listdir(directory)
138
+ # Filter files to only include CSV files
139
+ csv_files = [file for file in all_files if file.endswith(".csv")]
140
+
141
+ # Select a CSV file from the list
142
+ selected_csv = st.selectbox("Select a CSV file from the list", ["None"] + csv_files)
143
+
144
+ # Upload the CSV file
145
  uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
146
 
147
  # Define the unsupervised model
 
149
  selected_model = st.selectbox("Choose an anomaly model", anomalymodel)
150
 
151
  # Read and display the CSV file
152
+ if selected_csv != "None" or uploaded_file is not None:
153
+ if uploaded_file:
154
+ try:
155
+ delimiter = ','
156
+ insurance_claims = pd.read_csv (uploaded_file, sep=delimiter)
157
+ except ValueError:
158
+ delimiter = '|'
159
+ insurance_claims = pd.read_csv (uploaded_file, sep=delimiter, encoding='latin-1')
160
+ else:
161
+ insurance_claims = pd.read_csv(selected_csv)
162
 
163
  s = setup(insurance_claims, session_id = 123)
164