Spaces:
Sleeping
Sleeping
add: streamlit appe
Browse files- frontend/__init__.py +0 -0
- frontend/app.py +25 -0
frontend/__init__.py
ADDED
File without changes
|
frontend/app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import requests
|
3 |
+
|
4 |
+
st.title("🏦 Loan Approval Prediction")
|
5 |
+
|
6 |
+
gender = st.selectbox("Gender", ["Male", "Female"])
|
7 |
+
married = st.selectbox("Marital Status", ["Unmarried", "Married"])
|
8 |
+
credit = st.selectbox("Credit History", ["Clear Debts", "Unclear Debts"])
|
9 |
+
income = st.number_input("Applicant Income", min_value=0)
|
10 |
+
loan_amt = st.number_input("Loan Amount", min_value=0)
|
11 |
+
|
12 |
+
if st.button("Predict"):
|
13 |
+
payload = {
|
14 |
+
"Gender": gender,
|
15 |
+
"Married": married,
|
16 |
+
"Credit_History": credit,
|
17 |
+
"ApplicantIncome": income,
|
18 |
+
"LoanAmount": loan_amt
|
19 |
+
}
|
20 |
+
try:
|
21 |
+
response = requests.post("http://localhost:5000/prediction", json=payload)
|
22 |
+
result = response.json()
|
23 |
+
st.success(f"Loan Status: {result['loan_approval_status']}")
|
24 |
+
except Exception as e:
|
25 |
+
st.error(f"API Error: {e}")
|