AshenH commited on
Commit
9e0ef17
·
verified ·
1 Parent(s): c921174

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -35
app.py CHANGED
@@ -366,45 +366,48 @@ with gr.Blocks(title=APP_TITLE) as demo:
366
  js="() => { document.querySelector('html').classList.toggle('dark'); }"
367
  )
368
 
369
- scenario_dd = gr.Dropdown(
370
- label="Select Stress Scenario",
371
- choices=["Baseline", "Liquidity Stress: High Deposit Runoff", "IRR Stress: Rate Shock"],
372
- value="Baseline"
373
- )
374
-
375
- with gr.Accordion("Stress Scenario Parameters", open=False):
376
- runoff_slider = gr.Slider(
377
- label="Deposit Runoff (%)",
378
- minimum=0, maximum=100, step=1, value=20,
379
- info="For Liquidity Stress: Percentage of key deposits that run off."
380
- )
381
- shock_slider = gr.Slider(
382
- label="Rate Shock (bps)",
383
- minimum=-500, maximum=500, step=25, value=200,
384
- info="For IRR Stress: Parallel shift in the yield curve in basis points."
385
- )
386
-
387
  with gr.Row():
388
- as_of = gr.Textbox(label="As of date", interactive=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
 
390
- a1 = gr.Markdown("The amount of Assets maturing tomorrow (T+1) is...")
391
- a2 = gr.Markdown("The amount of Sources of Funds (SoF) maturing tomorrow (T+1) is...")
392
- a3 = gr.Markdown("The resulting Net Liquidity Gap for tomorrow (T+1) is...")
 
 
 
 
393
 
394
- with gr.Row():
395
- with gr.Column(scale=2):
396
  chart = gr.Plot(label="Maturity Ladder")
397
- ladder_df = gr.Dataframe(label="Ladder Detail")
398
- irr_df = gr.Dataframe(
399
- label="Interest-Rate Risk (BPV/DV01)",
400
- headers=["Bucket", "Portfolio Value (LKR Mn)", "BPV (DV01)"]
401
- )
402
- with gr.Column(scale=1):
403
- explain_text = gr.Markdown("Analysis of the T+1 gap will appear here...")
404
- drivers_df = gr.Dataframe(
405
- label="T+1 Gap Drivers (Top Products)",
406
- headers=["Product", "Bucket", "Amount (LKR Mn)"],
407
- )
 
408
 
409
  refresh_btn.click(
410
  fn=run_dashboard,
 
366
  js="() => { document.querySelector('html').classList.toggle('dark'); }"
367
  )
368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  with gr.Row():
370
+ # --- Left Column: Controls and Explanations ---
371
+ with gr.Column(scale=1):
372
+ scenario_dd = gr.Dropdown(
373
+ label="Select Stress Scenario",
374
+ choices=["Baseline", "Liquidity Stress: High Deposit Runoff", "IRR Stress: Rate Shock"],
375
+ value="Baseline"
376
+ )
377
+ with gr.Accordion("Stress Scenario Parameters", open=True):
378
+ runoff_slider = gr.Slider(
379
+ label="Deposit Runoff (%)",
380
+ minimum=0, maximum=100, step=1, value=20,
381
+ info="For Liquidity Stress: Percentage of key deposits that run off."
382
+ )
383
+ shock_slider = gr.Slider(
384
+ label="Rate Shock (bps)",
385
+ minimum=-500, maximum=500, step=25, value=200,
386
+ info="For IRR Stress: Parallel shift in the yield curve in basis points."
387
+ )
388
+ explain_text = gr.Markdown("Analysis of the T+1 gap will appear here...")
389
 
390
+ # --- Right Column: KPIs, Charts, and Tables ---
391
+ with gr.Column(scale=3):
392
+ with gr.Row():
393
+ as_of = gr.Textbox(label="As of date", interactive=False)
394
+ a1 = gr.Markdown("The amount of Assets maturing tomorrow (T+1) is...")
395
+ a2 = gr.Markdown("The amount of Sources of Funds (SoF) maturing tomorrow (T+1) is...")
396
+ a3 = gr.Markdown("The resulting Net Liquidity Gap for tomorrow (T+1) is...")
397
 
 
 
398
  chart = gr.Plot(label="Maturity Ladder")
399
+
400
+ with gr.Tabs():
401
+ with gr.TabItem("Ladder Detail"):
402
+ ladder_df = gr.Dataframe()
403
+ with gr.TabItem("T+1 Gap Drivers"):
404
+ drivers_df = gr.Dataframe(
405
+ headers=["Product", "Bucket", "Amount (LKR Mn)"],
406
+ )
407
+ with gr.TabItem("Interest-Rate Risk (BPV/DV01)"):
408
+ irr_df = gr.Dataframe(
409
+ headers=["Bucket", "Portfolio Value (LKR Mn)", "BPV (DV01)"]
410
+ )
411
 
412
  refresh_btn.click(
413
  fn=run_dashboard,