VectorV17 commited on
Commit
4fa324b
·
verified ·
1 Parent(s): 9d049cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -1
app.py CHANGED
@@ -166,4 +166,66 @@ with io.Blocks() as app:
166
  # Header Branding Section
167
  io.Markdown(
168
  """
169
- <div style='text-align: center; margin-bottom: 30px; padding: 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  # Header Branding Section
167
  io.Markdown(
168
  """
169
+ <div style='text-align: center; margin-bottom: 30px; padding: 10px 0; border-bottom: 1px solid #1f293d;'>
170
+ <h1 style='color: #38bdf8; font-size: 2.2rem; font-weight: 800; margin-bottom: 5px;'>🏦 Institutional Loan Underwriting Portal</h1>
171
+ <p style='color: #64748b; font-size: 1.1rem; margin: 0;'>Automated Corporate Underwriting Risk Pipeline • Optimized Stacking Ensemble <b>(92.18% Accuracy)</b></p>
172
+ </div>
173
+ """
174
+ )
175
+
176
+ with io.Row():
177
+ # Input Workspace Panel (Left Side)
178
+ with io.Column(scale=2):
179
+
180
+ with io.Column(elem_classes="section_panel"):
181
+ io.Markdown("<span style='color:#38bdf8; font-weight:700;'>📊 SEGMENT 1: REQUESTED CAPITAL</span>")
182
+ with io.Row():
183
+ loan = io.Number(label="Loan Amount ($) [LOAN]", value=15000)
184
+ reason = io.Dropdown(choices=["DebtCon", "HomeImp"], label="Purpose [REASON]", value="DebtCon")
185
+
186
+ with io.Column(elem_classes="section_panel"):
187
+ io.Markdown("<span style='color:#38bdf8; font-weight:700;'>🏠 SEGMENT 2: FINANCIAL STANDING</span>")
188
+ with io.Row():
189
+ mortdue = io.Number(label="Mortgage Value Owed ($) [MORTDUE]", value=50000)
190
+ value = io.Number(label="Property Asset Value ($) [VALUE]", value=85000)
191
+ with io.Row():
192
+ job = io.Dropdown(choices=["Other", "Mgr", "Office", "ProfExe", "Sales", "Self"], label="Job Field [JOB]", value="Other")
193
+ yoj = io.Number(label="Years at Current Job [YOJ]", value=5)
194
+
195
+ with io.Column(elem_classes="section_panel"):
196
+ io.Markdown("<span style='color:#38bdf8; font-weight:700;'>💳 SEGMENT 3: REPAYMENT PERFORMANCES</span>")
197
+ with io.Row():
198
+ debtinc = io.Number(label="Debt-to-Income Ratio (%) [DEBTINC]", value=32.5)
199
+ clage = io.Number(label="Oldest Account Line (Months) [CLAGE]", value=180)
200
+ with io.Row():
201
+ delinq = io.Number(label="Delinquent Credit Lines [DELINQ]", value=0)
202
+ derog = io.Number(label="Derogatory Incidents [DEROG]", value=0)
203
+ with io.Row():
204
+ ninq = io.Number(label="Recent Bureau Inquiries [NINQ]", value=1)
205
+ clno = io.Number(label="Total Active Credit Lines [CLNO]", value=20)
206
+
207
+ # Replaced io.Spacer() with direct margin styling configuration inside button
208
+ submit_btn = io.Button("⚡ Run Stacking Underwriting Evaluation", variant="primary")
209
+
210
+ # Output Feed Hub Panel (Right Side)
211
+ with io.Column(scale=1):
212
+ with io.Column(elem_classes="section_panel"):
213
+ io.Markdown("<span style='color:#64748b; font-weight:700;'>🏁 ANALYSIS HUB</span>")
214
+ output_html = io.HTML(
215
+ value="""
216
+ <div style='color: #475569; background-color: #0b0f19; border-radius: 8px; border: 2px dashed #1f293d; padding: 50px 20px; text-align: center; font-style: italic; font-size: 0.95rem;'>
217
+ System standby. Supply application parameters and trigger execution to populate real-time risk diagnostic logs.
218
+ </div>
219
+ """
220
+ )
221
+
222
+ # UI Wiring Connectors
223
+ submit_btn.click(
224
+ fn=evaluate_loan_risk,
225
+ inputs=[loan, mortdue, value, reason, job, yoj, derog, delinq, clage, ninq, clno, debtinc],
226
+ outputs=output_html
227
+ )
228
+
229
+ if __name__ == "__main__":
230
+ # Correctly passes title and css keywords inside the .launch constructor to support Gradio 6.0+
231
+ app.launch(css=custom_css, title="AI Loan Underwriting Portal", share=True)