-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebserver.py
39 lines (27 loc) · 922 Bytes
/
webserver.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
from flask import Flask, request, jsonify
import author_inference
import author_identification_grapher as grapher
import requests
from flask import Flask, request, render_template, send_from_directory
import re
app = Flask(__name__)
@app.route('/')
def my_form():
return render_template('layouts/index.html',
input1=None,
output="Prediction")
@app.route('/submit', methods=['POST'])
def my_form_post():
input1 = request.form['input1']
result = author_inference.predict(input1)
return grapher.make_graph(input1, result)
'''
return render_template('layouts/index.html',
input1=input1,
output=response)
'''
@app.route('/js/<path:path>')
def send_js(path):
return send_from_directory('js', path)
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True, port=5000)