File size: 6,086 Bytes
823efa7
464abf1
 
823efa7
464abf1
823efa7
8da7048
fce081d
8da7048
464abf1
 
 
 
823efa7
 
464abf1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8da7048
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
title: Hindi Banking Voice Assistant
emoji: 🏦
colorFrom: yellow
colorTo: green
sdk: gradio
sdk_version: 5.9.1
python: 13.1
app_file: app.py
pinned: true
license: mit
suggested_hardware: cpu-basic
short_description: Hindi voice assistant for banking & govt schemes
---

# 🏦 बैंकिंग सहायक — Hindi Banking Voice Assistant

A voice-powered AI assistant for Indian users to understand banking, loans, and government financial schemes — entirely in **Hindi**. Runs on **CPU Basic** (free tier) via HF Inference API.

## 🔑 Setup (Required — One Time)

1. Go to your Space → **Settings → Secrets**
2. Add secret → **Name:** `HF_TOKEN` | **Value:** your free HF read token from [hf.co/settings/tokens](https://hf.co/settings/tokens)

That's it. All 3 models are called via API — nothing loads into the Space's RAM.

---

## 🤖 Models Used

| Role | Model |
|------|-------|
| Speech-to-Text | `openai/whisper-large-v3-turbo` |
| LLM | `Telugu-LLM-Labs/Indic-gemma-7b-finetuned-sft-Navarasa-2.0` |
| Text-to-Speech | `ai4bharat/indic-parler-tts` |

---

## 🔄 Pipeline

```
🎤 Hindi Audio

[HF API] openai/whisper-large-v3-turbo      →  Hindi transcript

Jargon Normalization (local, pure Python)   →  kist→EMI, zamanat→collateral ...

Keyword RAG Retrieval (local, pure Python)  →  top 3 relevant KB passages

[HF API] Indic-gemma-7b (Navarasa 2.0)     →  Hindi answer grounded in KB

[HF API] ai4bharat/indic-parler-tts         →  Hindi speech audio

🔊 Answer (audio + text + citations)
```

**Local compute:** ~50 MB RAM for knowledge base + retriever. Zero GPU required.

---

## ⏱️ Expected Response Times (free tier)

| Step | Time |
|------|------|
| STT (Whisper API) | 5–10s |
| RAG Retrieval | < 1s |
| LLM (Indic-Gemma API) | 15–40s (cold start up to 60s) |
| TTS (Parler API) | 10–20s |
| **Total** | **~30–70s per query** |

> First call may be slower due to HF cold start. The app retries automatically.

---

## 📖 Knowledge Base Coverage

### Banks (12)
SBI, HDFC Bank, ICICI Bank, Axis Bank, Kotak Mahindra Bank, PNB, Bank of Baroda, Canara Bank, Union Bank of India, Indian Bank, Small Finance Banks (AU / Ujjivan / Equitas / Jana), Regional Rural Banks & Co-operative Banks, NBFCs (Bajaj Finance / Muthoot / Manappuram)

### Government Credit Schemes (11)

| Scheme | Coverage |
|--------|----------|
| PM Mudra Yojana | Shishu / Kishore / Tarun loans up to ₹10L (Tarun Plus ₹20L) |
| Stand-Up India | SC/ST & women entrepreneurs ₹10L–₹1Cr |
| PM SVANidhi | Street vendors ₹10K → ₹20K → ₹50K |
| PMEGP + KVIC | Employment generation with 15–35% govt subsidy |
| CGTMSE + ECLGS | Collateral-free MSME loans |
| PM Awas Yojana CLSS | Home loan interest subsidy for EWS / LIG / MIG |
| Kisan Credit Card | Agricultural credit at effective 4% p.a. |
| PM Vishwakarma | Artisan loans at 5% concessional rate |
| PMJDY + Overdraft | Zero-balance accounts + ₹10,000 overdraft |
| Vidya Lakshmi + CSIS | Education loans + interest subsidy |
| NRLM-SHG | Women Self Help Group bank linkage program |

### Social Security Schemes (6)

| Scheme | Benefit |
|--------|---------|
| PMJJBY | ₹2 lakh life insurance at ₹436/year |
| PMSBY | ₹2 lakh accident insurance at ₹20/year |
| Atal Pension Yojana | Guaranteed monthly pension for unorganized sector |
| PM-KISAN | ₹6,000/year direct income support for farmers |
| EPFO / EPF / EPS | Provident fund & pension for formal employees |
| PMFBY | Crop insurance at 1.5–2% farmer premium |
| MGNREGS | 100 days guaranteed employment per year |

### Financial Terms & Concepts
EMI, CIBIL Score, KYC documents, MCLR & Repo Rate, Collateral & Guarantor, Moratorium & Loan Restructuring, Processing Fees & Prepayment Charges, NPA & OTS, Loan types (home / personal / vehicle / gold / education / LAP), UPI / NEFT / RTGS, FD / RD, Microfinance (JLG / SHG), Consumer Rights & RBI Ombudsman

---

## 📁 Repository Structure

```
app.py              Gradio app + HF Inference API pipeline (STT → RAG → LLM → TTS)
rag_pipeline.py     Jargon normalization map, keyword retriever, prompt builder
knowledge_base.py   40+ documents in English (retrieved, answers given in Hindi)
requirements.txt    Minimal: gradio, requests, soundfile, numpy
README.md           This file (HF Space config + documentation)
```

---

## 💡 Design Principles

- **Grounded answers only** — LLM responds only from retrieved KB content, not hallucinations
- **Always in Hindi** — STT, LLM prompt, and TTS all enforce Hindi throughout
- **One follow-up at a time** — conversational, not overwhelming
- **Spoken-friendly output** — short sentences, no technical jargon in answers
- **Graceful fallback** — says "बैंक से संपर्क करें" when information is unavailable
- **Extensible** — adding a new language requires only changing STT language code + TTS voice description

---

## 📝 Example Questions

- मुझे होम लोन के लिए कौन से दस्तावेज़ चाहिए?
- EMI क्या होती है और कैसे calculate होती है?
- मुद्रा लोन कैसे मिलेगा?
- CIBIL score क्या होता है?
- PM Awas Yojana में subsidy कैसे मिलती है?
- जन धन खाता कैसे खोलें?
- किसान क्रेडिट कार्ड क्या है?
- महिला स्वयं सहायता समूह को loan कैसे मिलेगा?

---

> ⚠️ **Disclaimer:** This assistant provides general information only. For actual financial decisions, please consult your bank or a certified financial advisor.
> यह assistant केवल सामान्य जानकारी देता है। वित्तीय निर्णयों के लिए अपने बैंक या certified advisor से सलाह लें।