File size: 5,095 Bytes
eee15d4
8ef276c
 
 
 
eee15d4
8ef276c
eee15d4
 
 
 
 
8ef276c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e459b45
8ef276c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
title: Voice Assistant - Multi-language Division Matching & Contact Search
emoji: πŸŽ™οΈ
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 4.0.0
app_file: app.py
pinned: false
license: mit
---

# πŸŽ™οΈ Voice Assistant Demo

A powerful multi-language voice assistant that helps users find divisions and contacts within an organization using natural language queries.

## 🌟 Features

### πŸ—£οΈ Multi-language Voice Input
- **99+ languages** supported (auto-detected)
- Automatic speech-to-text using OpenAI Whisper
- Arabic-to-English translation for seamless processing
- Works with various audio formats

### 🎯 Smart Division Matching
- Semantic search using sentence embeddings
- Confidence-based routing with intelligent thresholds
- Department-level expansion (searches all divisions in a department)
- Fast matching (~50ms) using `all-MiniLM-L6-v2`

### πŸ‘€ Name Extraction
- Extracts person names from queries using GLiNER
- Supports English and Arabic names
- Zero-shot NER for robust extraction

### πŸ“ž Contact Search
- 500+ contacts across 23 departments and 67 divisions
- Intelligent matching combining name and division
- Confidence scoring with match reasoning
- Fuzzy name matching for typos and variations

## πŸš€ How to Use

### Division Matching (Text)
Find the right division for your query:
```
"I need help from IT Security"
"Find someone in Finance"
"Connect me to Human Resources"
```

### Division Matching (Voice)
Speak your query in any language - it will be transcribed and processed automatically.

### Contact Search (Text)
Search for specific people or teams:
```
"Find Dima in Information Technology"
"Ahmed Al-Malek"
"I need to talk to someone in Legal"
```

### Contact Search (Voice)
Speak your contact search query in any language.

## πŸ“Š Example Queries

### Department-Level Queries
These queries search across ALL divisions in a department:
- βœ… "Find someone in Information Technology" β†’ Searches 8 IT divisions
- βœ… "I need help from Finance" β†’ Searches all Finance divisions
- βœ… "Connect me to Human Resources" β†’ Searches all HR divisions

### Division-Level Queries
These match specific divisions:
- βœ… "Find Ahmed in App Dev" β†’ Applications Development & Integrations
- βœ… "I need help from IT Security" β†’ IT Security Implementation & Operations
- βœ… "Connect me to Legal" β†’ Legal divisions

### Name-Only Queries
- βœ… "Find Dima" β†’ Searches all contacts named Dima
- βœ… "Ahmed Al-Malek" β†’ Exact name match
- βœ… "I need to talk to Rashed" β†’ Fuzzy name matching

### Combined Queries (Name + Department/Division)
Priority given to division accuracy:
- βœ… "Find Dima in Information Technology" β†’ Perfect match (confidence: 1.00)
- βœ… "Find Ahmed in App Dev" β†’ Shows App Dev team members

## πŸ”§ Technical Details

### Models Used
- **Embeddings**: `sentence-transformers/all-MiniLM-L6-v2` - Fast, lightweight semantic search
- **Name Extraction**: `urchade/gliner_small-v2.1` - Zero-shot NER for person names
- **Speech-to-Text**: `openai/whisper-base` - Optimized for CPU with good accuracy

### Confidence Scoring

| Score | Meaning | Example |
|-------|---------|---------|
| **1.00** | Perfect match (name + division) | Dima in IT |
| **0.95** | Exact name match | Ahmed Al-Malek |
| **0.66** | Strong division match | People in requested division |
| **0.59** | Good division match | Close division match |
| **< 0.30** | Low confidence | Wrong division penalty |

### Match Reasons
- `name_and_division_match` - Both name AND division match βœ…
- `division_match` - Division/department matches (no name match)
- `exact_name_match` - Exact name match (100%)
- `fuzzy_name_match` - Partial name match (75%+)
- `name_match_wrong_division` - Name matches but WRONG division ⚠️

## πŸ“¦ Database Stats
- **500 contacts** across the organization
- **23 departments** (Information Technology, Finance, HR, etc.)
- **67 divisions** (specific teams and units)
- **Multi-language support** (English + Arabic names)

## 🌍 Supported Languages

The voice assistant supports **99+ languages** including:
- English
- Arabic (Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ©)
- Spanish, French, German, Italian
- Chinese (δΈ­ζ–‡), Japanese (ζ—₯本θͺž), Korean (ν•œκ΅­μ–΄)
- Hindi, Urdu, Bengali
- And many more...

Language is automatically detected - just speak naturally!

## ⚑ Performance

- **Division Matching**: ~50ms per query
- **Name Extraction**: ~100-200ms per query
- **Voice Processing**: ~1-3 seconds (depends on audio length)
- **Contact Search**: ~100-300ms per query

## πŸ› οΈ Built With

- **Gradio** - Interactive web interface
- **FastAPI** - Backend API (original implementation)
- **Sentence Transformers** - Semantic search
- **OpenAI Whisper** - Speech recognition
- **GLiNER** - Named Entity Recognition
- **PyTorch** - Deep learning framework

## πŸ“ License

MIT License

## πŸ™ Acknowledgments

- OpenAI for Whisper
- Hugging Face for model hosting
- URCHADE for GLiNER
- Sentence Transformers team

---

**Version:** 4.0.0
**Status:** βœ… Production Ready
**Demo Type:** Interactive Gradio Demo