def get_analysis():
	# Refresh posts
	posts = engine.get_insta_posts()
	sentiments = []
	for post in posts:
		sentiments.append(engine.get_caption_sentiment(post))

	# Gets current trend
	currTrend =  Counter(sentiments).most_common(1)[0][0]

	# Gets overall frequencies
	sentData = engine.get_sentiment_frequencies()
	sentimentFreqs = sentData[0]
	total = sentData[1]
	trend = sentData[2]

	jsonData = json.dumps(sentimentFreqs)
	print jsonData
	return render_template('analysis.html', data=jsonData, total=sentData[1], trend=trend, currTrend=currTrend)
def get_posts():
	posts = engine.get_insta_posts()
	sentiments = []
	for post in posts:
		sentiments.append(engine.get_caption_sentiment(post))
	return render_template('posts.html', data=zip(posts, sentiments))