yusufgundogdu commited on
Commit
5ce94cf
·
verified ·
1 Parent(s): d5022a6

Delete post_routes.py

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