-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
55 lines (26 loc) · 818 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
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# coding: utf-8
# In[11]:
from flask import Flask, request, render_template
# In[12]:
import joblib
# In[13]:
app = Flask(__name__)
# In[14]:
@app.route("/", methods = ["GET", "POST"])
def index():
if request.method == "POST":
rates = float(request.form.get("rates"))
print(rates)
model1 = joblib.load("regression")
pred1 = model1.predict([[rates]])
model2 = joblib.load("decision_tree")
pred2 = model2.predict([[rates]])
return(render_template("index.html", result1=pred1, result2=pred2))
else:
return(render_template("index.html", result1="Waiting", result2="Waiting"))
# In[ ]:
if __name__ == "__main__":
app.run()
# In[ ]:
# In[ ]: