Spaces:
Build error
Build error
fix: Improve handling of few keywords for topics
Browse files
app.py
CHANGED
@@ -172,7 +172,10 @@ def generate_plot(
|
|
172 |
cluster_keyword[label].append(cluster_words[most_descriptive[0]])
|
173 |
if len(cluster_keyword[label]) == 1:
|
174 |
cluster_keyword[label] = cluster_keyword[label][0]
|
175 |
-
|
|
|
|
|
|
|
176 |
encoded_labels_keywords = [cluster_keyword[encoded_label] for encoded_label in encoded_labels]
|
177 |
embeddings_2d = get_tsne_embeddings(embeddings)
|
178 |
plot = draw_interactive_scatter_plot(
|
|
|
172 |
cluster_keyword[label].append(cluster_words[most_descriptive[0]])
|
173 |
if len(cluster_keyword[label]) == 1:
|
174 |
cluster_keyword[label] = cluster_keyword[label][0]
|
175 |
+
elif len(cluster_keyword[label]) == 0:
|
176 |
+
cluster_keyword[label] = '-'
|
177 |
+
elif len(cluster_keyword[label]) > 1:
|
178 |
+
cluster_keyword[label] = ', '.join(cluster_keyword[label])
|
179 |
encoded_labels_keywords = [cluster_keyword[encoded_label] for encoded_label in encoded_labels]
|
180 |
embeddings_2d = get_tsne_embeddings(embeddings)
|
181 |
plot = draw_interactive_scatter_plot(
|