Spaces:
Sleeping
Delete app.py
Browse filesimport 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_data()
incoming = json.loads(incoming)
print(incoming)
# Сохраняем принятую JSON-строку в переменной "outs"
outs = incoming
# Возвращаем полученную JSON-строку в ответе
return json.dumps(outs)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
@@ -1,26 +0,0 @@
|
|
1 |
-
import flask
|
2 |
-
from flask import request, jsonify
|
3 |
-
import os
|
4 |
-
import json
|
5 |
-
from dotenv import load_dotenv
|
6 |
-
load_dotenv()
|
7 |
-
app = flask.Flask(__name__, template_folder="./")
|
8 |
-
@app.route('/')
|
9 |
-
def index():
|
10 |
-
return flask.render_template('index.html')
|
11 |
-
@app.route("/", methods=["POST"])
|
12 |
-
def predict():
|
13 |
-
incoming = request.get_json()
|
14 |
-
print(incoming)
|
15 |
-
# Ваша логика обработки текста здесь
|
16 |
-
return "Your response here"
|
17 |
-
@app.route("/avp", methods=["POST"])
|
18 |
-
def avp():
|
19 |
-
incoming = request.get_json()
|
20 |
-
print(incoming)
|
21 |
-
# Сохраняем принятый входящий запрос в переменной "outs"
|
22 |
-
outs = incoming
|
23 |
-
# Возвращаем параметр "outs" в виде строки JSON
|
24 |
-
return json.dumps(outs)
|
25 |
-
if __name__ == '__main__':
|
26 |
-
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|