-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
93 lines (79 loc) · 3.01 KB
/
forms.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from flask_wtf import FlaskForm
from wtforms import SelectField, IntegerField, SubmitField
from wtforms.validators import DataRequired
from wtforms.widgets import NumberInput
class PredictionForm(FlaskForm):
'''
Parameter for each field:
- id: column name that the model recognize
- label: text that will appear on the form
- description: tooltip of input field, on hover
'''
gender = SelectField(
id='Gender',
label='Gender',
description=['Gender of the applicant'],
choices=['Male', 'Female'])
married = SelectField(
id='Married',
label='Married',
description=['Marital status of the applicant'],
choices=['No', 'Yes'])
dependents = SelectField(
id='Dependents',
label='Number of Dependents',
description=['No. of people dependent on the applicant'],
choices=['0', '1', '2', '3+'])
education = SelectField(
id='Education',
label='Education',
description=['Education level of the applicant'],
choices=['Not Graduate', 'Graduate'])
self_employed = SelectField(
id='Self_Employed',
label='Self Employed',
description=['If the applicant is self-employed or not'],
choices=['No', 'Yes'])
applicant_income = IntegerField(
id='ApplicantIncome',
label='Applicant Income',
default=0,
description=['USD', 'The amount of income the applicant earns'],
validators=[DataRequired('Value must be greater than zero!')],
widget=NumberInput(min=0, max=999999)
)
coapplicant_income = IntegerField(
id='CoapplicantIncome',
label='Co-applicant Income',
default=0,
description=['USD', 'The amount of income the co-applicant earns'],
validators=[DataRequired('Value must be greater than zero!')],
widget=NumberInput(min=0, max=999999)
)
loan_amount = IntegerField(
id='LoanAmount',
label='Loan Amount',
default=0,
description=['USD', 'The amount of loan the applicant has requested for'],
validators=[DataRequired('Value must be greater than zero!')],
widget=NumberInput(min=0, max=999999)
)
loan_amount_term = IntegerField(
id='Loan_Amount_Term',
label='Loan Amount Term',
default=0,
description=['days', 'The no. of days over which the loan will be paid'],
validators=[DataRequired('Value must be greater than zero!')],
widget=NumberInput(min=0, max=9999)
)
credit_history = SelectField(
id='Credit_History',
label='Credit History',
description=['A record of a borrower\'s responsible repayment of debts'],
choices=[(0.0, 'Not paid'), (1.0, 'All debts paid')])
property_area = SelectField(
id='Property_Area',
label='Property Area',
description=['The type of location where the applicant’s property lies'],
choices=['Rural', 'Semiurban', 'Urban'])
submit = SubmitField(label='Predict!')