Instructions to use sanoramyun8/speaker-embedding-endpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- speechbrain
How to use sanoramyun8/speaker-embedding-endpoint with speechbrain:
# interface not specified in config.json
- Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- speaker-embedding
|
| 5 |
+
- speaker-verification
|
| 6 |
+
- speechbrain
|
| 7 |
+
- ecapa-tdnn
|
| 8 |
+
- audio
|
| 9 |
+
library_name: speechbrain
|
| 10 |
+
pipeline_tag: audio-classification
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Speaker Embedding Endpoint
|
| 14 |
+
|
| 15 |
+
Custom HuggingFace Inference Endpoint for extracting speaker embeddings using SpeechBrain's ECAPA-TDNN model.
|
| 16 |
+
|
| 17 |
+
## Model
|
| 18 |
+
|
| 19 |
+
This endpoint uses [speechbrain/spkrec-ecapa-voxceleb](https://huggingface.co/speechbrain/spkrec-ecapa-voxceleb) model which achieves:
|
| 20 |
+
- **0.80% EER** on VoxCeleb1 test set
|
| 21 |
+
- **192-dimensional** speaker embeddings
|
| 22 |
+
|
| 23 |
+
## Usage
|
| 24 |
+
|
| 25 |
+
### API Request
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
curl -X POST \
|
| 29 |
+
https://your-endpoint-url.endpoints.huggingface.cloud \
|
| 30 |
+
-H "Authorization: Bearer YOUR_HF_TOKEN" \
|
| 31 |
+
-H "Content-Type: audio/wav" \
|
| 32 |
+
--data-binary "@audio.wav"
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
### Response
|
| 36 |
+
|
| 37 |
+
```json
|
| 38 |
+
{
|
| 39 |
+
"embedding": [0.123, -0.456, ...],
|
| 40 |
+
"dimension": 192,
|
| 41 |
+
"model": "speechbrain/spkrec-ecapa-voxceleb"
|
| 42 |
+
}
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Speaker Verification
|
| 46 |
+
|
| 47 |
+
To verify if two audio files are from the same speaker:
|
| 48 |
+
|
| 49 |
+
1. Extract embeddings from both audio files
|
| 50 |
+
2. Calculate cosine similarity between embeddings
|
| 51 |
+
3. If similarity > 0.6 (threshold), same speaker
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from scipy.spatial.distance import cosine
|
| 55 |
+
|
| 56 |
+
similarity = 1 - cosine(embedding1, embedding2)
|
| 57 |
+
is_same_speaker = similarity > 0.6
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Project
|
| 61 |
+
|
| 62 |
+
Part of **Deep Truth** - AI Deepfake Voice Detection & Speaker Verification Service
|
| 63 |
+
|
| 64 |
+
- GitHub: https://github.com/yonghwan1106/deep-truth
|
| 65 |
+
- Demo: https://deep-truth.vercel.app
|