Last active
April 28, 2020 08:20
-
-
Save lakshay-arora/9159c58f1f1a36425221dee08aecdfe2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing the required libraries | |
from flask import Flask, render_template, request, redirect, url_for | |
from joblib import load | |
from get_tweets import get_related_tweets | |
# load the pipeline object | |
pipeline = load("text_classification.joblib") | |
# function to get results for a particular text query | |
def requestResults(name): | |
# get the tweets text | |
tweets = get_related_tweets(name) | |
# get the prediction | |
tweets['prediction'] = pipeline.predict(tweets['tweet_text']) | |
# get the value counts of different labels predicted | |
data = str(tweets.prediction.value_counts()) + '\n\n' | |
return data + str(tweets) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment