Skip to content

Commit

Permalink
final project
Browse files Browse the repository at this point in the history
  • Loading branch information
harshitsoni01 committed Jul 7, 2020
0 parents commit d6051ca
Show file tree
Hide file tree
Showing 40 changed files with 216,035 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
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
37 changes: 37 additions & 0 deletions App/app.py
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)
Loading

0 comments on commit d6051ca

Please sign in to comment.