Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -164,13 +164,19 @@ def visualize_clusters(df):
|
|
| 164 |
|
| 165 |
def main(file, num_clusters):
|
| 166 |
try:
|
|
|
|
| 167 |
file_data = file.read()
|
| 168 |
df = pd.read_excel(BytesIO(file_data))
|
|
|
|
|
|
|
| 169 |
df = preprocess_data(df)
|
| 170 |
df = cluster_data(df, num_clusters)
|
| 171 |
visualize_clusters(df)
|
|
|
|
|
|
|
| 172 |
return df
|
| 173 |
except Exception as e:
|
|
|
|
| 174 |
return str(e)
|
| 175 |
|
| 176 |
|
|
|
|
| 164 |
|
| 165 |
def main(file, num_clusters):
|
| 166 |
try:
|
| 167 |
+
print("Reading the file...")
|
| 168 |
file_data = file.read()
|
| 169 |
df = pd.read_excel(BytesIO(file_data))
|
| 170 |
+
print("File read successfully.")
|
| 171 |
+
|
| 172 |
df = preprocess_data(df)
|
| 173 |
df = cluster_data(df, num_clusters)
|
| 174 |
visualize_clusters(df)
|
| 175 |
+
|
| 176 |
+
print("Returning the dataframe.")
|
| 177 |
return df
|
| 178 |
except Exception as e:
|
| 179 |
+
print("Error occurred:", e)
|
| 180 |
return str(e)
|
| 181 |
|
| 182 |
|