-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
26 lines (21 loc) · 697 Bytes
/
Copy pathapp.py
File metadata and controls
26 lines (21 loc) · 697 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
from flask import Flask, jsonify, request, render_template
from inference import infer
app = Flask(__name__)
@app.route("/", methods=["GET"])
def index():
return render_template('index.html')
@app.route("/about", methods=["GET"])
def about():
return render_template('about.html')
@app.route("/accept", methods=["POST"])
def accept_text():
data = request.get_json()
user_text = data.get('text')
if not user_text:
return jsonify({"error": "No text was provided"}), 400
return jsonify(infer(user_text))
@app.route("/performance", methods=["GET"])
def performance():
return render_template('performance.html')
if __name__ == "__main__":
app.run(debug=True)