yusufgundogdu commited on
Commit
4ea3892
·
verified ·
1 Parent(s): d14d920

Delete routes/post.py

Browse files
Files changed (1) hide show
  1. routes/post.py +0 -29
routes/post.py DELETED
@@ -1,29 +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
- if not request.json:
9
- return jsonify({"error": "No data received"}), 400
10
- return jsonify({"probability_up": np.random.rand()})
11
- except Exception as e:
12
- return jsonify({"error": str(e)}), 500
13
-
14
- @app.route('/add-user', methods=['POST'])
15
- def add_user():
16
- try:
17
- req_data = request.json
18
- if not req_data or "name" not in req_data:
19
- return jsonify({"error": "Name is required"}), 400
20
-
21
- new_user = {
22
- "id": len(data["users"]) + 1,
23
- "name": req_data["name"],
24
- "score": req_data.get("score", 0)
25
- }
26
- data["users"].append(new_user)
27
- return jsonify({"message": "User added"}), 201
28
- except Exception as e:
29
- return jsonify({"error": str(e)}), 500