Spaces:
Sleeping
Sleeping
File size: 994 Bytes
b782fda 33e04c8 b782fda |
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 |
import streamlit as st
import requests
st.title("🏦 Loan Approval Prediction")
gender = st.selectbox("Gender", ["Male", "Female"])
married = st.selectbox("Marital Status", ["Unmarried", "Married"])
credit = st.selectbox("Credit History", ["Clear Debts", "Unclear Debts"])
income = st.number_input("Applicant Income", min_value=0)
loan_amt = st.number_input("Loan Amount", min_value=0)
if st.button("Predict"):
payload = {
"Gender": gender,
"Married": married,
"Credit_History": credit,
"ApplicantIncome": income,
"LoanAmount": loan_amt
}
try:
response = requests.post("http://localhost:5000/prediction", json=payload)
result = response.json()
if result['loan_approval_status'] == "Rejected":
st.error(f"Loan Status: {result['loan_approval_status']}")
else:
st.success(f"Loan Status: {result['loan_approval_status']}")
except Exception as e:
st.error(f"API Error: {e}")
|