Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -359,8 +359,12 @@ def extract_problem_domains(df,
|
|
| 359 |
console_messages.append(f"Center shape: {center.shape}, type: {type(center)}")
|
| 360 |
|
| 361 |
if isinstance(center, np.ndarray) and center.ndim == 1:
|
|
|
|
| 362 |
top_word_indices = center.argsort()[-top_words:][::-1]
|
| 363 |
# top_word_indices = center.argsort()[-top_words:][::-1].tolist()
|
|
|
|
|
|
|
|
|
|
| 364 |
|
| 365 |
console_messages.append(f"Top word indices for cluster {i}: {top_word_indices}")
|
| 366 |
top_words = [feature_names[index] for index in top_word_indices]
|
|
|
|
| 359 |
console_messages.append(f"Center shape: {center.shape}, type: {type(center)}")
|
| 360 |
|
| 361 |
if isinstance(center, np.ndarray) and center.ndim == 1:
|
| 362 |
+
# Ensure center.argsort() returns a numpy array
|
| 363 |
top_word_indices = center.argsort()[-top_words:][::-1]
|
| 364 |
# top_word_indices = center.argsort()[-top_words:][::-1].tolist()
|
| 365 |
+
|
| 366 |
+
if isinstance(top_word_indices, np.ndarray):
|
| 367 |
+
top_word_indices = top_word_indices.tolist()
|
| 368 |
|
| 369 |
console_messages.append(f"Top word indices for cluster {i}: {top_word_indices}")
|
| 370 |
top_words = [feature_names[index] for index in top_word_indices]
|