File size: 876 Bytes
d4952da 650f47a d4952da 5e27817 d4952da 650f47a 0fa16fe c741805 d4952da 10321f6 |
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 |
import flask
from flask import request, jsonify
import os
import json
from dotenv import load_dotenv
load_dotenv()
app = flask.Flask(__name__, template_folder="./")
@app.route('/')
def index():
return flask.render_template('index.html')
@app.route("/", methods=["POST"])
def predict():
incoming = request.get_json()
print(incoming)
# Ваша логика обработки текста здесь
return "Your response here"
@app.route("/avp", methods=["POST"])
def avp():
incoming = request.get_json()
print(incoming)
# Сохраняем принятый входящий запрос в переменной "outs"
outs = incoming
# Возвращаем параметр "outs" в виде строки JSON
return json.dumps(outs)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860))) |