Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -477,11 +477,14 @@ df.drop(columns={col_to_delete}, inplace=True)
|
|
477 |
text_data = ' '.join(df[text_col].dropna()).strip()
|
478 |
|
479 |
if text_data: # Check if there is any text data to use
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
|
|
|
|
|
|
485 |
else:
|
486 |
st.error("No words available to create a word cloud. Please check the selected text data.")
|
487 |
else:
|
|
|
477 |
text_data = ' '.join(df[text_col].dropna()).strip()
|
478 |
|
479 |
if text_data: # Check if there is any text data to use
|
480 |
+
try:
|
481 |
+
wordcloud = WordCloud(width=800, height=400).generate(text_data)
|
482 |
+
fig, ax = plt.subplots()
|
483 |
+
ax.imshow(wordcloud, interpolation='bilinear')
|
484 |
+
ax.axis('off')
|
485 |
+
st.pyplot(fig)
|
486 |
+
except ValueError as e:
|
487 |
+
st.error("Failed to generate word cloud: " + str(e))
|
488 |
else:
|
489 |
st.error("No words available to create a word cloud. Please check the selected text data.")
|
490 |
else:
|