-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflaskApp.py
More file actions
43 lines (25 loc) · 820 Bytes
/
flaskApp.py
File metadata and controls
43 lines (25 loc) · 820 Bytes
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
import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
from run import predict_flask
app = Flask(__name__)
@app.route('/')
def home():
var = -1
start = "Get Started"
return render_template('index.html', var=var, start=start)
#Method One
@app.route('/predict', methods=['GET', 'POST'])
def predict():
var = -1
if request.method == 'POST':
text = request.form['text']
var = predict_flask(text)
var = not var
start = "Try Another Clause"
return render_template('index.html', var=var,text=text, start = start)
# #Method Two (Hard Coding)
# @app.route('/predict_api', method=['POST'])
# def predict_api():
if __name__ == "__main__":
app.run(debug=True)