la / app.py
ajeetkumar01's picture
Create app.py
9c49948 verified
raw
history blame contribute delete
713 Bytes
# 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()