How to add WordCloud graph in Streamlit

I want to add the wordcloud to streamlit app to show thw related words in the tweets.

1 Like

Great question and you absolutely can do this with st.pyplot() and wordcloud. Here’s a simple example:

import streamlit as st
from wordcloud import WordCloud
import matplotlib.pyplot as plt

# Create some sample text
text = 'Fun, fun, awesome, awesome, tubular, astounding, superb, great, amazing, amazing, amazing, amazing'

# Create and generate a word cloud image:
wordcloud = WordCloud().generate(text)

# Display the generated image:
plt.imshow(wordcloud, interpolation='bilinear')

Let me know if that works for you!