Wanted to add this quick solution to generating wordclouds in Dash with the python library wordcloud. This code generates wordcloud from a dictionary The wordcloud object is converted to an image. The image is passed to Dash without having to save the image to disk.
from wordcloud import WordCloud
import base64
from io import BytesIO
di = {'abc':10, 'def': 20, 'ghi':2, 'jkl':55}
wc = WordCloud().generate_from_frequencies(frequencies=di)
wc_img = wc.to_image()
with BytesIO() as buffer:
wc_img.save(buffer, 'png')
img2 = base64.b64encode(buffer.getvalue()).decode()
app.layout = html.Div(children=[
html.Img(src="data:image/png;base64," + img2)
])