-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
59 lines (50 loc) · 1.89 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
from distutils.log import debug
from flask import Flask, render_template, request,url_for
import loan as l
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("index.html")
@app.route("/submit", methods=['POST'])
def submit():
if request.method == "POST":
gender = request.form['gender']
dependents = request.form['dependents']
graduate = request.form['graduate']
selfEmployed = request.form['employed']
applicantIncome = request.form['applicantIncome']
coApplicantIncome = request.form['coApplicantIncome']
loanAmount = request.form['loanAmount']
loanAmountTerm = request.form['loanAmountTerm']
creditHistory = request.form['creditHistory']
propertyArea = request.form['propertyArea']
married = request.form['married']
loan_pred = l.loan_prediction(dependents, graduate, applicantIncome, coApplicantIncome, loanAmount, creditHistory, propertyArea, gender, married, selfEmployed)
gen = "Male" if gender==1 else "Female"
marr = "Yes" if married == 1 else "No"
depend = "3+" if dependents ==3 else str(dependents)
grad = "Yes" if graduate ==0 else "No"
empl = "Yes" if selfEmployed==1 else "No"
prop = ""
if propertyArea == 0:
prop = "Urban"
elif propertyArea == 1:
prop = "SemiUrban"
else:
prop = "Rural"
return render_template("submit.html",
gender=gen,
married=marr,
dependents=depend,
graduate=grad,
selfEmployed=empl,
applicantIncome=applicantIncome,
coApplicantIncome=coApplicantIncome,
loanAmount=loanAmount,
loanAmountTerm=loanAmountTerm,
creditHistory=creditHistory,
propertyArea=prop,
loan_pred=loan_pred
)
if __name__ == "__main__":
app.run(debug=True)