-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
90 lines (31 loc) · 1.1 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# importing packages
import math
import pandas as pd
import numpy as np
import re
import nltk
from nltk.corpus import stopwords
from preprocess import preprocess
##Creating a list of stop words and adding custom stopwords
stop_words = set(stopwords.words("english"))
import logging
from flask import Flask,Blueprint, flash, redirect, render_template, request, url_for,json,current_app, jsonify
app = Flask(__name__)
logger = logging.getLogger(__name__)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/predict',methods=['POST'])
def predict():
if request.method =='POST':
my_prediction = preprocess()
return render_template('result.html',prediction = my_prediction)
@app.route('/results',methods=['POST'])
def results():
if request.method =='POST':
method_prediction = preprocess()
responses = jsonify(prediction = method_prediction)
responses.status_code = 200
return (responses)
if __name__ == '__main__':
app.run(host='0.0.0.0',port=8000)