ajeetkumar01 commited on
Commit
9c49948
·
verified ·
1 Parent(s): 299d391

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Filename: loan_approval_app.py
2
+
3
+ import gradio as gr
4
+ from sklearn.ensemble import RandomForestClassifier
5
+ import numpy as np
6
+
7
+ # Dummy model
8
+ model = RandomForestClassifier()
9
+ X = np.array([[30000, 700, 50000], [20000, 600, 30000], [40000, 800, 100000]])
10
+ y = np.array([1, 0, 1])
11
+ model.fit(X, y)
12
+
13
+ def approve(income, credit, loan_amount):
14
+ pred = model.predict([[income, credit, loan_amount]])[0]
15
+ return "Approved ✅" if pred == 1 else "Rejected ❌"
16
+
17
+ gr.Interface(
18
+ fn=approve,
19
+ inputs=[gr.Number(label="Income"),
20
+ gr.Number(label="Credit Score"),
21
+ gr.Number(label="Loan Amount")],
22
+ outputs=gr.Textbox(label="Loan Status"),
23
+ title="💰 Loan Approval Prediction"
24
+ ).launch()