File size: 713 Bytes
9c49948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Filename: loan_approval_app.py

import gradio as gr
from sklearn.ensemble import RandomForestClassifier
import numpy as np

# Dummy model
model = RandomForestClassifier()
X = np.array([[30000, 700, 50000], [20000, 600, 30000], [40000, 800, 100000]])
y = np.array([1, 0, 1])
model.fit(X, y)

def approve(income, credit, loan_amount):
    pred = model.predict([[income, credit, loan_amount]])[0]
    return "Approved βœ…" if pred == 1 else "Rejected ❌"

gr.Interface(
    fn=approve,
    inputs=[gr.Number(label="Income"),
            gr.Number(label="Credit Score"),
            gr.Number(label="Loan Amount")],
    outputs=gr.Textbox(label="Loan Status"),
    title="πŸ’° Loan Approval Prediction"
).launch()