-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrunner.py
More file actions
43 lines (26 loc) · 972 Bytes
/
runner.py
File metadata and controls
43 lines (26 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from flask import Flask, request, jsonify
from model import product_ui
from Shap_controller import get_response_for_all_players
import pandas as pd
app = Flask(__name__)
from flask_cors import CORS
CORS(app)
@app.route("/predict", methods=["GET"])
def predict():
pickle_file = "trained_model.pkl"
latest_stats_file = "latest_stats.pkl"
product_ui(pickle_file, latest_stats_file )
return jsonify({"status": "success"})
@app.route("/shap", methods=["POST"])
def shap():
print("hi")
data = request.get_json()
if 'intermediate' in data:
player_name_list = data['intermediate']
print(player_name_list["current"])
response_list = get_response_for_all_players(player_name_list=player_name_list["current"])
return jsonify({"data" : response_list}), 200
else:
return jsonify({'status': 'error', 'message': 'intermediate not provided'}), 400
if __name__ == "__main__":
app.run(debug=True)