Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,15 @@ loan_amnt = st.slider('Loan Amount', min_value=0.0, max_value=1000000.0, step=10
|
|
| 32 |
int_rate = st.slider('Interest Rate (%)', min_value=0.0, max_value=30.0, step=0.1, value=5.0)
|
| 33 |
installment = st.slider('EMI Amount', min_value=0.0, max_value=10000.0, step=10.0, value=200.0)
|
| 34 |
annual_inc = st.slider('Annual Income', min_value=0.0, max_value=1000000.0, step=1000.0, value=50000.0)
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Set default values for the missing features
|
| 38 |
dti = 0.0 # Example default value for DTI
|
|
@@ -68,9 +76,12 @@ input_data = input_data[num_features + ['loan_amnt_by_income']] # Only keep fea
|
|
| 68 |
|
| 69 |
# Predict using the model
|
| 70 |
if st.button('Predict'):
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
int_rate = st.slider('Interest Rate (%)', min_value=0.0, max_value=30.0, step=0.1, value=5.0)
|
| 33 |
installment = st.slider('EMI Amount', min_value=0.0, max_value=10000.0, step=10.0, value=200.0)
|
| 34 |
annual_inc = st.slider('Annual Income', min_value=0.0, max_value=1000000.0, step=1000.0, value=50000.0)
|
| 35 |
+
|
| 36 |
+
# CIBIL score input as a text field
|
| 37 |
+
cibil_score = st.text_input('CIBIL Score (Enter a number between 300 and 900)', value='700')
|
| 38 |
+
|
| 39 |
+
# Convert the CIBIL score input to a numeric value
|
| 40 |
+
try:
|
| 41 |
+
cibil_score = int(cibil_score)
|
| 42 |
+
except ValueError:
|
| 43 |
+
st.error("Please enter a valid number for CIBIL Score.")
|
| 44 |
|
| 45 |
# Set default values for the missing features
|
| 46 |
dti = 0.0 # Example default value for DTI
|
|
|
|
| 76 |
|
| 77 |
# Predict using the model
|
| 78 |
if st.button('Predict'):
|
| 79 |
+
if 300 <= cibil_score <= 900: # Ensure CIBIL score is within the valid range
|
| 80 |
+
prediction = model.predict(input_data)
|
| 81 |
+
result = "Defaulted" if prediction[0] == 1 else "Not Defaulted"
|
| 82 |
+
color = "red" if prediction[0] == 1 else "green"
|
| 83 |
+
st.markdown(f"""
|
| 84 |
+
<div style="font-size: 24px; color: {color}; font-weight: bold;">Prediction: {result}</div>
|
| 85 |
+
""", unsafe_allow_html=True)
|
| 86 |
+
else:
|
| 87 |
+
st.error("Please enter a CIBIL Score between 300 and 900.")
|