-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
46 lines (35 loc) · 1.28 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
from flask import Flask, request, render_template
import joblib
import numpy as np
app = Flask(__name__)
model = joblib.load('Recession_Model')
@app.route('/')
def home():
return render_template("index.html")
@app.route('/predict', methods=['GET', 'POST'])
def predict():
if request.method == 'POST':
year=int(request.form['year'])
gdp=float(request.form['gdp'])
inflation=float(request.form['inflation'])
ip=float(request.form['ip'])
job=int(request.form['job'])
quarter = request.form['quarter']
if (quarter=='First Quarter'):
quarter=1
elif(quarter=='Second Quarter'):
quarter=2
elif(quarter=='Third Quarter'):
quarter=3
else:
quarter=4
prediction = model.predict([[year,quarter,gdp,inflation,ip,job]])
if(prediction == 1):
prediction="Recession will happen by your given circumstances"
else:
prediction="Recession won't happen by your given circumstances"
return render_template("prediction.html", prediction_text="{}".format(prediction))
else:
return render_template("prediction.html")
if __name__ == "__main__":
app.run(debug=True , host='0.0.0.0')