toxic_test / main.py
HMPhuoc's picture
Update main.py
39e27f0 verified
raw
history blame
1.05 kB
from flask import Flask, request
from app import judge, judgePlus, judgeBert
from phoBERT import BERT_predict
from flask_cors import CORS
import threading
import time
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)
return result
@app.route("/checkplus", methods=["POST"])
def checkPlus():
comment = request.json['comment']
result = judgePlus(comment)
return result
@app.route("/checkbert", methods=["POST"])
def checkBert():
comment = request.json['comment']
result = judgeBert(comment)
return result
@app.route("/check_time")
def time():
l10 = []
l100 = []
l200 = []
return 'ok'
if __name__ == '__main__':
app.run(debug=False, threaded=True)