File size: 1,735 Bytes
a328f3b
4363d38
feb2487
a328f3b
 
 
 
 
4363d38
feb2487
 
 
a328f3b
feb2487
a328f3b
 
feb2487
a328f3b
feb2487
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a328f3b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: ECL Risk Analyzer
emoji: ๐Ÿ’น
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
- credit-risk
- gemini
- finance
pinned: false
short_description: AI ECL analyzer using Streamlit and Gemini.
---

# ๐Ÿงฎ ECL Risk Analyzer

**ECL Risk Analyzer** is a Streamlit-based web app that automates **Expected Credit Loss (ECL)** analysis and provides **AI-driven recommendations** on credit decisions.

### ๐Ÿ” Features
- Upload loan datasets (CSV format).  
- Compute key credit metrics:
  - **PD** โ€“ Probability of Default  
  - **LGD** โ€“ Loss Given Default  
  - **EAD** โ€“ Exposure at Default  
  - **ECL** โ€“ Expected Credit Loss  
- Visualize segment-level performance with interactive charts.  
- Get AI recommendations (via **Gemini 2.5 Flash Lite**) to:
  - Increase interest  
  - Reduce disbursement  
  - Maintain current policy  
- Role-based access:
  - **Analyst:** Run and review segment analyses.  
  - **CRO:** Audit all analyst reports and view trends.  

### ๐Ÿง  Tech Stack
- **Frontend:** Streamlit  
- **AI Engine:** Gemini API  
- **Database:** SQLite (via SQLAlchemy)  
- **Hosting:** Hugging Face Spaces (Docker SDK)  

### ๐Ÿš€ Quick Start
1. Upload your loan dataset (CSV).  
2. Select a segmentation column (e.g., loan intent, area, or occupation).  
3. View computed ECL metrics and charts.  
4. Choose a segment to get AI-based recommendations.  

### ๐Ÿ“Š Example Output
| Segment | PD | LGD | EAD | ECL | Action |
|----------|----|-----|-----|-----|--------|
| Medical | 0.278 | 0.255 | 78M | 5.5M | Increase Interest |

### ๐Ÿ› ๏ธ Customization
Modify `/src/streamlit_app.py` to:
- Adjust prompts or logic.  
- Change chart styles.  
- Extend user roles or security.