Spaces:
Runtime error
Runtime error
| import flask | |
| from flask import request, jsonify | |
| import os | |
| import json | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| app = flask.Flask(__name__, template_folder="./") | |
| def index(): | |
| return flask.render_template('index.html') | |
| def predict(): | |
| incoming = request.get_json() | |
| print(incoming) | |
| # Ваша логика обработки текста здесь | |
| return "Your response here" | |
| def avp(): | |
| incoming = request.get_json() | |
| print(incoming) | |
| result = {} | |
| for key, value in incoming.items(): | |
| if int(value) > 0: | |
| result[key] = str(int(value) - 1) | |
| else: | |
| result[key] = "0" | |
| response = jsonify(result) | |
| return response | |
| if __name__ == '__main__': | |
| app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860))) |