-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d6051ca
Showing
40 changed files
with
216,035 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
env/ | ||
env5/ | ||
App/Untitled.ipynb | ||
App/Untitled1.ipynb | ||
App/Untitled2.ipynb | ||
Untitled.ipynb | ||
__pycache__ | ||
.ipynb_checkpoints | ||
App/__pycache__ | ||
.DS_Store | ||
App/pipeline1.sav | ||
Untitled1.ipynb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from flask import Flask, abort, jsonify, request, render_template | ||
import joblib | ||
from feature import * | ||
import json | ||
from find_real_news import get_real_news # get real news from NewsAPI | ||
|
||
pipeline = joblib.load('./pipeline_final.sav') | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/') | ||
def home(): | ||
name = "TechnologIQ" | ||
return render_template('index.html', name=name) | ||
|
||
|
||
@app.route('/api', methods=['POST']) | ||
def get_delay(): | ||
|
||
result = request.form | ||
query_news = result['news'] | ||
# returns dictionary with language, original text and translated text | ||
translated_query = lang_translate(query_news) | ||
cleaned_query = remove_punctuation_stopwords_lemma( | ||
translated_query["final_text"]) | ||
query = get_all_query(translated_query["final_text"]) | ||
pred = pipeline.predict(query) | ||
print(pred) | ||
|
||
# if news is fake, display alternative real news using NewsAPI | ||
real_news = get_real_news(translated_query["final_text"]) | ||
return render_template('resultpage.html', test="test2", pred=pred, translated_query=translated_query, cleaned_query=cleaned_query, real_news=real_news) | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(port=8080, debug=True) |
Oops, something went wrong.