ifiecas commited on
Commit
000931d
·
verified ·
1 Parent(s): 0d29fbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -342,16 +342,16 @@ with tab1:
342
  manual_rejection = False
343
  rejection_reason = ""
344
 
345
- # Rule-based rejections that override the model
346
  if total_income < 1500:
347
  manual_rejection = True
348
- rejection_reason = "Insufficient income (below $1,500 monthly minimum)"
349
- elif dti_percent > 50: # Very high DTI is an automatic rejection
350
  manual_rejection = True
351
- rejection_reason = "Debt-to-income ratio too high (exceeds 50%)"
352
  elif credit_history == 0 and dti_percent > 35:
353
  manual_rejection = True
354
- rejection_reason = "Combination of unsettled loans and high debt-to-income ratio"
355
 
356
  # Final decision combines model prediction and manual eligibility checks
357
  final_approval = (prediction[0] == 1) and not manual_rejection
@@ -369,7 +369,6 @@ with tab1:
369
  <div class="result-rejected">
370
  <h3 style="color: #C62828;">❌ Loan Not Approved</h3>
371
  <p>Unfortunately, based on your current information, we cannot approve your loan application.</p>
372
- <p><strong>Primary reason:</strong> {rejection_reason if manual_rejection else "Multiple factors considered by our approval algorithm"}</p>
373
  <p>Consider improving your credit score, reducing existing debt, or applying with a co-applicant with higher income.</p>
374
  </div>
375
  """, unsafe_allow_html=True)
 
342
  manual_rejection = False
343
  rejection_reason = ""
344
 
345
+ # Rule-based rejections that override the model (but don't show to user)
346
  if total_income < 1500:
347
  manual_rejection = True
348
+ rejection_reason = "Insufficient income"
349
+ elif dti_percent > 50:
350
  manual_rejection = True
351
+ rejection_reason = "Payment too high relative to income"
352
  elif credit_history == 0 and dti_percent > 35:
353
  manual_rejection = True
354
+ rejection_reason = "Credit history and payment factors"
355
 
356
  # Final decision combines model prediction and manual eligibility checks
357
  final_approval = (prediction[0] == 1) and not manual_rejection
 
369
  <div class="result-rejected">
370
  <h3 style="color: #C62828;">❌ Loan Not Approved</h3>
371
  <p>Unfortunately, based on your current information, we cannot approve your loan application.</p>
 
372
  <p>Consider improving your credit score, reducing existing debt, or applying with a co-applicant with higher income.</p>
373
  </div>
374
  """, unsafe_allow_html=True)