-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
36 lines (30 loc) · 1.07 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
from flask import Flask,request,jsonify
from flask_cors import CORS
from flask import Flask,render_template,url_for,request
from flask_bootstrap import Bootstrap
from werkzeug import secure_filename
#from bert import Ner
app = Flask(__name__)
#CORS(app)
Bootstrap(app)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/predict', methods=['POST', 'GET'])
def predict():
if request.method == 'POST':
#model = Ner("/deploy/app/model")
#text = request.json["query"]
text =request.form["query"]
try:
#out = model.predict(text)
#return jsonify({"result":out})
#return render_template("results.html", prediction =out ,name =text)
#return render_template("results.html", prediction =jsonify(out) ,name =text)
return render_template("results.html", prediction =out ,name =text)
except Exception as e:
print(e)
return jsonify({"result":"Model Failed"})
if __name__ == "__main__":
app.run('0.0.0.0',port=8000,debug=True)
#app.run(debug=True)