Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -247,8 +247,12 @@ def extract_problem_domains(df,
|
|
| 247 |
# Get representative words for each cluster
|
| 248 |
cluster_representations = {}
|
| 249 |
for topic in range(len(topic_model.get_topic_info())):
|
| 250 |
-
|
| 251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
# Map cluster labels to representative words
|
| 254 |
df["Problem_Cluster"] = topics
|
|
@@ -317,7 +321,9 @@ def process_excel(file):
|
|
| 317 |
|
| 318 |
except Exception as e:
|
| 319 |
# return str(e) # Return the error message
|
| 320 |
-
|
|
|
|
|
|
|
| 321 |
|
| 322 |
|
| 323 |
|
|
|
|
| 247 |
# Get representative words for each cluster
|
| 248 |
cluster_representations = {}
|
| 249 |
for topic in range(len(topic_model.get_topic_info())):
|
| 250 |
+
topic_words = topic_model.get_topic(topic)
|
| 251 |
+
if isinstance(topic_words, list) and len(topic_words) > 0 and isinstance(topic_words[0], tuple):
|
| 252 |
+
words = [word for word, _ in topic_words[:top_words]]
|
| 253 |
+
else:
|
| 254 |
+
words = []
|
| 255 |
+
cluster_representations[topic] = words
|
| 256 |
|
| 257 |
# Map cluster labels to representative words
|
| 258 |
df["Problem_Cluster"] = topics
|
|
|
|
| 321 |
|
| 322 |
except Exception as e:
|
| 323 |
# return str(e) # Return the error message
|
| 324 |
+
error_message = f"Error processing file: {str(e)}"
|
| 325 |
+
print(error_message) # Log the error
|
| 326 |
+
return error_message # Return the error message to the user
|
| 327 |
|
| 328 |
|
| 329 |
|