Spaces:
Build error
Build error
feat: Adding try catch for not enough words topics
Browse files
app.py
CHANGED
@@ -166,7 +166,10 @@ def generate_plot(
|
|
166 |
cluster_to_words_similarities = sorted(cluster_to_words_similarities, key=lambda x: x[1], reverse=True)
|
167 |
st.write(cluster_to_words_similarities)
|
168 |
while len(cluster_keyword[label]) < 3:
|
169 |
-
|
|
|
|
|
|
|
170 |
cluster_keyword[label].append(cluster_words[most_descriptive[0]])
|
171 |
cluster_keyword[label] = ', '.join(cluster_keyword[label])
|
172 |
encoded_labels_keywords = [cluster_keyword[encoded_label] for encoded_label in encoded_labels]
|
|
|
166 |
cluster_to_words_similarities = sorted(cluster_to_words_similarities, key=lambda x: x[1], reverse=True)
|
167 |
st.write(cluster_to_words_similarities)
|
168 |
while len(cluster_keyword[label]) < 3:
|
169 |
+
try:
|
170 |
+
most_descriptive = cluster_to_words_similarities.pop(0)
|
171 |
+
except IndexError:
|
172 |
+
continue
|
173 |
cluster_keyword[label].append(cluster_words[most_descriptive[0]])
|
174 |
cluster_keyword[label] = ', '.join(cluster_keyword[label])
|
175 |
encoded_labels_keywords = [cluster_keyword[encoded_label] for encoded_label in encoded_labels]
|