-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
49 lines (24 loc) · 794 Bytes
/
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
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from flask import Flask, render_template, request
# In[2]:
app = Flask(__name__)
# In[3]:
import joblib
@app.route("/", methods = ["GET", "POST"])
def index():
if request.method == "POST":
rates = float(request.form.get("rates"))
print(rates)
model1 = joblib.load("Regression_DBS")
r1 = model1.predict([[rates]])
model2 = joblib.load("Tree_DBS")
r2 = model2.predict([[rates]])
return(render_template("index.html",result1=r1,result2=r2))
else:
return(render_template("index.html",result1="waiting",result2="waiting"))
# In[ ]:
if __name__ == "__main__": # if this program is yours, then run, otherwise, dont run
app.run()
# In[ ]: