图片高度宽度设置一下,字体重新换一下,simhei,图片格式换成jpg看看
@app.task
def gen_world(article_content,sha1):
article_lcut, article_content_important = seg_depart(article_content, 10)
fo = wordcloud.WordCloud(width=800, height=600, font_path=r"simhei.ttf")
# 词云需要的是字符串然后进行生成,对于article_lcut列表,中间用空格进行分割
fo.generate(" ".join(article_lcut))
fo.to_file('E:/code_home/PycharmProjects/mySpiderzwdtweb/media/article/ciyunimg/' + sha1 + '.jpg')
return sha1 + '-ok'