Delete post_routes.py
Browse files- post_routes.py +0 -23
post_routes.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
from flask import request, jsonify
|
| 2 |
-
import numpy as np
|
| 3 |
-
|
| 4 |
-
def init_post_routes(app, data):
|
| 5 |
-
@app.route('/predict', methods=['POST'])
|
| 6 |
-
def predict():
|
| 7 |
-
try:
|
| 8 |
-
return jsonify({"probability_up": np.random.rand()})
|
| 9 |
-
except Exception as e:
|
| 10 |
-
return jsonify({"error": str(e)}), 500
|
| 11 |
-
|
| 12 |
-
@app.route('/add-user', methods=['POST'])
|
| 13 |
-
def add_user():
|
| 14 |
-
try:
|
| 15 |
-
new_user = {
|
| 16 |
-
"id": len(data["users"]) + 1,
|
| 17 |
-
"name": request.json["name"],
|
| 18 |
-
"score": request.json.get("score", 0)
|
| 19 |
-
}
|
| 20 |
-
data["users"].append(new_user)
|
| 21 |
-
return jsonify({"message": "User added"}), 201
|
| 22 |
-
except Exception as e:
|
| 23 |
-
return jsonify({"error": str(e)}), 400
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|