|
from flask import Flask, request |
|
from app import judge |
|
from train.add_data import add |
|
from flask_cors import CORS |
|
|
|
app = Flask(__name__) |
|
CORS(app) |
|
|
|
@app.route("/") |
|
def hello(): |
|
return {"hello":"Deploy success"} |
|
|
|
@app.route("/test") |
|
def test(): |
|
return "Test success" |
|
|
|
@app.route("/test/<text>") |
|
def returnText(text): |
|
return f'The text is {text}' |
|
|
|
@app.route("/check", methods=["POST"]) |
|
def check(): |
|
comment = request.json['comment'] |
|
result = judge(comment) |
|
add(comment, result[0], result[1], result[2], result[3], result[4], result[5]) |
|
return result |