Delete endpoints /post_endpoints.py
Browse files- endpoints /post_endpoints.py +0 -26
endpoints /post_endpoints.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
from flask import jsonify, request
|
| 2 |
-
import numpy as np
|
| 3 |
-
from ..app import shared_data
|
| 4 |
-
|
| 5 |
-
def predict():
|
| 6 |
-
try:
|
| 7 |
-
if not request.json:
|
| 8 |
-
return jsonify({"error": "No data received"}), 400
|
| 9 |
-
return jsonify({"probability_up": np.random.rand()})
|
| 10 |
-
except Exception as e:
|
| 11 |
-
return jsonify({"error": str(e)}), 500
|
| 12 |
-
|
| 13 |
-
def add_user():
|
| 14 |
-
try:
|
| 15 |
-
if not request.json or "name" not in request.json:
|
| 16 |
-
return jsonify({"error": "Name is required"}), 400
|
| 17 |
-
|
| 18 |
-
new_user = {
|
| 19 |
-
"id": len(shared_data["users"]) + 1,
|
| 20 |
-
"name": request.json["name"],
|
| 21 |
-
"score": request.json.get("score", 0)
|
| 22 |
-
}
|
| 23 |
-
shared_data["users"].append(new_user)
|
| 24 |
-
return jsonify({"message": "User added", "user": new_user}), 201
|
| 25 |
-
except Exception as e:
|
| 26 |
-
return jsonify({"error": str(e)}), 500
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|