def get_scrapped_tweets(username): twuser = TwitterUser(username, MAX_TWEETS) raw = [] for tweet in twuser.tweets: text = tweet.text for hashtag in tweet.hashtags: text = text.replace('#' + hashtag, '') for referral in tweet.referrals: text = text.replace('@' + referral, '') raw.append(text) tweets = raw hastags = [' '.join(tweet.hashtags) for tweet in twuser.tweets] results = tweets2tags(tweets, hastags) img = wordcloud_generator.generate(results) image_buffer = cStringIO.StringIO() img.save('cloud.png', format='PNG') #return base64.b64encode(image_buffer.getvalue()) return send_file('../../cloud.png', mimetype="image/png")
def get_scrapped_tweets(username): twuser = TwitterUser(username, MAX_TWEETS) raw = [] for tweet in twuser.tweets: text = tweet.text for hashtag in tweet.hashtags: text = text.replace('#'+hashtag, '') for referral in tweet.referrals: text = text.replace('@'+referral, '') raw.append(text) tweets = raw hastags = [' '.join(tweet.hashtags) for tweet in twuser.tweets] results = tweets2tags(tweets, hastags) img = wordcloud_generator.generate(results) image_buffer = cStringIO.StringIO() img.save('cloud.png', format='PNG') #return base64.b64encode(image_buffer.getvalue()) return send_file('../../cloud.png', mimetype="image/png")
def vis(): img = wordcloud_generator.generate() img.save('webfest/base/cloud.png', 'PNG') return send_file('cloud.png', mimetype="image/png")