Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
a8995cc
1
Parent(s):
3a4e108
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,16 @@ def index():
|
|
12 |
def avp():
|
13 |
incoming = request.get_json()
|
14 |
print(incoming)
|
15 |
-
#
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
return jsonify(response)
|
21 |
if __name__ == '__main__':
|
22 |
-
app.run(host='0.0.0.0',
|
|
|
12 |
def avp():
|
13 |
incoming = request.get_json()
|
14 |
print(incoming)
|
15 |
+
# Изменение значений ключей входящего JSON файла
|
16 |
+
for key in incoming:
|
17 |
+
# Уменьшаем значение ключа на 1
|
18 |
+
incoming[key] -= 1
|
19 |
+
# Сохранение изменений в JSON файле
|
20 |
+
with open("output.json", "w") as f:
|
21 |
+
json.dump(incoming, f)
|
22 |
+
# Возвращение измененного JSON файла в ответе сервера
|
23 |
+
with open("output.json", "r") as f:
|
24 |
+
response = json.load(f)
|
25 |
return jsonify(response)
|
26 |
if __name__ == '__main__':
|
27 |
+
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|