nunclud commited on
Commit
90eac7d
·
verified ·
1 Parent(s): ce1265f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -6,28 +6,26 @@ import pandas as pd
6
  model = joblib.load('loan_RFmodel.joblib')
7
 
8
 
9
- def predict_loan(gender, married, dependents, education, self_employed,
10
  income, co_income, amount, term, history, area):
11
 
12
 
13
  features = pd.DataFrame([[
14
  gender, married, dependents, education, self_employed,
15
  income, co_income, amount, term, history, area
16
- ]], columns=['Gender', 'Married', 'Dependents', 'Education', 'Self_Employed',
17
  'ApplicantIncome', 'CoapplicantIncome', 'LoanAmount',
18
  'Loan_Amount_Term', 'Credit_History', 'Property_Area'])
19
 
20
  prediction = model.predict(features)[0]
21
- return "✅ Loan Approved" if prediction == 1 else "❌ Loan Rejected"
22
 
23
  demo = gr.Interface(
24
  fn=predict_loan,
25
  inputs=[
26
- gr.Dropdown(choices=[(1, "Male"), (0, "Female")], label="Gender"),
27
  gr.Dropdown(choices=[(1, "Yes"), (0, "No")], label="Married"),
28
  gr.Number(label="Dependents (0, 1, 2, or 3)"),
29
  gr.Dropdown(choices=[(0, "Graduate"), (1, "Not Graduate")], label="Education"),
30
- gr.Dropdown(choices=[(1, "Yes"), (0, "No")], label="Self Employed"),
31
  gr.Number(label="Applicant Income"),
32
  gr.Number(label="Co-applicant Income"),
33
  gr.Number(label="Loan Amount"),
 
6
  model = joblib.load('loan_RFmodel.joblib')
7
 
8
 
9
+ def predict_loan(married, dependents, education,
10
  income, co_income, amount, term, history, area):
11
 
12
 
13
  features = pd.DataFrame([[
14
  gender, married, dependents, education, self_employed,
15
  income, co_income, amount, term, history, area
16
+ ]], columns=['Married', 'Dependents', 'Education',
17
  'ApplicantIncome', 'CoapplicantIncome', 'LoanAmount',
18
  'Loan_Amount_Term', 'Credit_History', 'Property_Area'])
19
 
20
  prediction = model.predict(features)[0]
21
+ return "Loan Approved" if prediction == 1 else "Loan Rejected"
22
 
23
  demo = gr.Interface(
24
  fn=predict_loan,
25
  inputs=[
 
26
  gr.Dropdown(choices=[(1, "Yes"), (0, "No")], label="Married"),
27
  gr.Number(label="Dependents (0, 1, 2, or 3)"),
28
  gr.Dropdown(choices=[(0, "Graduate"), (1, "Not Graduate")], label="Education"),
 
29
  gr.Number(label="Applicant Income"),
30
  gr.Number(label="Co-applicant Income"),
31
  gr.Number(label="Loan Amount"),