Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,17 +21,17 @@ MAX_FEATURES_TO_SHOW = 10
|
|
| 21 |
def update_dropdown(file):
|
| 22 |
"""Update dropdown choices with column names from the uploaded file."""
|
| 23 |
if file is None:
|
| 24 |
-
return gr.
|
| 25 |
try:
|
| 26 |
if file.name.endswith('.csv'):
|
| 27 |
df = pd.read_csv(file.name)
|
| 28 |
elif file.name.endswith('.xlsx'):
|
| 29 |
df = pd.read_excel(file.name)
|
| 30 |
else:
|
| 31 |
-
return gr.
|
| 32 |
-
return gr.
|
| 33 |
except Exception as e:
|
| 34 |
-
return gr.
|
| 35 |
|
| 36 |
def analyze_file(file, label_col, n_clusters):
|
| 37 |
"""Analyze the uploaded file with ML techniques and return results and plots."""
|
|
|
|
| 21 |
def update_dropdown(file):
|
| 22 |
"""Update dropdown choices with column names from the uploaded file."""
|
| 23 |
if file is None:
|
| 24 |
+
return gr.update(choices=[], value=None)
|
| 25 |
try:
|
| 26 |
if file.name.endswith('.csv'):
|
| 27 |
df = pd.read_csv(file.name)
|
| 28 |
elif file.name.endswith('.xlsx'):
|
| 29 |
df = pd.read_excel(file.name)
|
| 30 |
else:
|
| 31 |
+
return gr.update(choices=[], value=None)
|
| 32 |
+
return gr.update(choices=list(df.columns), value=None)
|
| 33 |
except Exception as e:
|
| 34 |
+
return gr.update(choices=[], value=None)
|
| 35 |
|
| 36 |
def analyze_file(file, label_col, n_clusters):
|
| 37 |
"""Analyze the uploaded file with ML techniques and return results and plots."""
|