forked from gauthamys/hackelth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
75 lines (59 loc) · 1.71 KB
/
app.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from flask import *
from StatFuncs import *
from flask_cors import CORS
from flask import request
#import pandas as pd
app = Flask(__name__)
CORS(app)
@app.route('/',methods=['GET'])
def root():
return render_template('index.html', message = "Flask")
@app.route('/get_sr_costs',methods=['GET'])
def sr_costs():
return get_sr_costs()
@app.route('/get_device',methods=['GET'])
def sys():
return get_sys()
@app.route('/get_service',methods=['GET'])
def service_data():
return get_service_plot()
@app.route('/get_service_month',methods=['GET'])
def service_month_data():
return get_service_month()
@app.route('/get_parts',methods=['GET'])
def parts_data():
return get_parts_counts()
@app.route('/get_sys_freqs',methods=['GET'])
def get_freqencies():
return get_freq_sys()
@app.route('/get_ec',methods=['GET'])
def get_ec_data():
return get_ec_stats()
@app.route('/get_total_ec',methods=['GET'])
def get_freq_used():
return get_total_ec()
@app.route('/get_devices',methods=['GET'])
def get_devs():
return get_devices()
@app.route('/get_labels',methods=['GET'])
def get_lbs():
return get_labels()
@app.route('/predict',methods=['POST'])
def get_predictions():
data = request.json
sysid = data['sysid']
return predict(sysid)
@app.route('/device_stats',methods=['POST'])
def get_neighbors():
data = request.json
print(data)
sysid = data['sysid']
return get_device_stats(sysid)
@app.route('/part_predict',methods=['POST'])
def get_part_predictions():
data = request.json
print(data)
sysid = data['sysid']
return get_sys_parts(sysid)
if __name__ == '__main__':
app.run(debug=False)