yusufgundogdu commited on
Commit
af885f0
·
verified ·
1 Parent(s): 3197a1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -1,24 +1,25 @@
1
- from flask import Flask, request, jsonify
2
- import numpy as np
 
3
 
4
  app = Flask(__name__)
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  @app.route('/')
7
  def home():
8
  return "stablediffusionapi test"
9
 
10
- @app.route('/predict', methods=['POST'])
11
- def predict():
12
- try:
13
- data = request.json
14
- if not data:
15
- return jsonify({"error": "Keine Daten erhalten"}), 400
16
- X_input = np.array([[data["Open"], data["High"], data["Low"], data["Close"], data["Volume"]]])
17
- probability = np.random.rand()
18
- return jsonify({"probability_up": float(probability)})
19
-
20
- except Exception as e:
21
- return jsonify({"error": str(e)}), 500
22
-
23
  if __name__ == '__main__':
24
  app.run(host='0.0.0.0', port=7860)
 
1
+ from flask import Flask
2
+ from get_routes import init_get_routes
3
+ from post_routes import init_post_routes
4
 
5
  app = Flask(__name__)
6
 
7
+ # Paylaşılan veri
8
+ shared_data = {
9
+ "users": [
10
+ {"id": 1, "name": "Ahmet", "score": 85},
11
+ {"id": 2, "name": "Mehmet", "score": 92}
12
+ ],
13
+ "models": ["model1", "model2", "model3"]
14
+ }
15
+
16
+ # Route'ları başlat
17
+ init_get_routes(app, shared_data)
18
+ init_post_routes(app, shared_data)
19
+
20
  @app.route('/')
21
  def home():
22
  return "stablediffusionapi test"
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  if __name__ == '__main__':
25
  app.run(host='0.0.0.0', port=7860)