I have a program written in a Jupyter notebook that creates a wordcloud but I am having a hard time coverting it to work in Streamlit. I know I need to add the code import streamlit as st and then use st.pylpot() but I could not get the right syntax and figured it would be easier to share the raw text before entering the streamlit specific code.
import Wordcloud from wordcloud import WordCloud import matplotlib.pyplot as plt from matplotlib import font_manager # Create a WordCloud object wordcloud = WordCloud(font_path= "C:\\windows\\Fonts\\simsun", background_color="white", max_words=5000, contour_width=3, contour_color='steelblue') # Generate a word cloud wordcloud.generate(long_string) plt.figure(figsize = (15, 10)) plt.imshow(wordcloud, interpolation="bilinear") plt.axis("off") plt.show() # Visualize the word cloud #wordcloud.to_image()
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Have the worldcloud data display
Explain what you expect to happen when you run the code above.
I get at the moment which is obvious that there is no module called wordcloud.
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
- Streamlit version: 1.15.1
- Python version: 3.9.15
- Using Conda
- OS version: Windows 10
- Browser version: Chrome
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
- Link to your GitHub repo:
- Link to your deployed app:
If needed, add any other context about the problem here.