Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
303051b
1
Parent(s):
fd56604
Update app.py
Browse files
app.py
CHANGED
@@ -1,36 +1,18 @@
|
|
1 |
import flask
|
2 |
-
from flask import request, jsonify, send_file
|
3 |
import os
|
4 |
import json
|
5 |
from dotenv import load_dotenv
|
6 |
load_dotenv()
|
7 |
app = flask.Flask(__name__)
|
8 |
app.config["DEBUG"] = True
|
9 |
-
@app.route('/')
|
10 |
def index():
|
11 |
-
return
|
12 |
-
@app.route("/", methods=["POST"])
|
13 |
-
def predict():
|
14 |
-
try:
|
15 |
-
incoming = request.get_json()
|
16 |
-
print(incoming)
|
17 |
-
|
18 |
-
# Ваша логика обработки текста здесь
|
19 |
-
# ...
|
20 |
-
# Формирование и возврат ответа в формате JSON
|
21 |
-
response = {
|
22 |
-
"message": "Response from server"
|
23 |
-
}
|
24 |
-
return jsonify(response)
|
25 |
-
|
26 |
-
except Exception as e:
|
27 |
-
error_response = {
|
28 |
-
"error": str(e)
|
29 |
-
}
|
30 |
-
return jsonify(error_response), 500
|
31 |
@app.route("/avp", methods=["POST"])
|
32 |
def avp():
|
33 |
try:
|
|
|
34 |
incoming = request.get_json()
|
35 |
print(incoming)
|
36 |
|
|
|
1 |
import flask
|
2 |
+
from flask import request, jsonify, send_file, render_template
|
3 |
import os
|
4 |
import json
|
5 |
from dotenv import load_dotenv
|
6 |
load_dotenv()
|
7 |
app = flask.Flask(__name__)
|
8 |
app.config["DEBUG"] = True
|
9 |
+
@app.route('/', methods=['GET'])
|
10 |
def index():
|
11 |
+
return render_template('index.html')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
@app.route("/avp", methods=["POST"])
|
13 |
def avp():
|
14 |
try:
|
15 |
+
# Получение JSON-данных из запроса
|
16 |
incoming = request.get_json()
|
17 |
print(incoming)
|
18 |
|