Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
pipeline_tag: audio-classification
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- deepfake
|
| 8 |
+
- audio
|
| 9 |
+
- wav2vec2
|
| 10 |
+
- pytorch
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# π Deepfake Audio Detection Model
|
| 14 |
+
|
| 15 |
+
## π Overview
|
| 16 |
+
This model detects whether an audio file is **REAL or FAKE (AI-generated voice)**.
|
| 17 |
+
|
| 18 |
+
It is based on **Wav2Vec2 architecture** and uses transformer-based audio embeddings.
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## π― Task
|
| 23 |
+
Binary Classification:
|
| 24 |
+
- 0 β REAL AUDIO
|
| 25 |
+
- 1 β FAKE AUDIO
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## π₯ Input
|
| 30 |
+
- Audio file (.wav)
|
| 31 |
+
- Sampling rate: 16kHz
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## π€ Output
|
| 36 |
+
- Fake probability (0 to 1)
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## βοΈ Model Files
|
| 41 |
+
- pytorch_model.bin
|
| 42 |
+
- config.json
|
| 43 |
+
- preprocessor_config.json
|
| 44 |
+
- tokenizer files
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## π Usage
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
from transformers import AutoProcessor, AutoModel
|
| 52 |
+
import librosa
|
| 53 |
+
import torch
|
| 54 |
+
|
| 55 |
+
processor = AutoProcessor.from_pretrained("Simma7/audio_model")
|
| 56 |
+
model = AutoModel.from_pretrained("Simma7/audio_model")
|
| 57 |
+
|
| 58 |
+
audio, sr = librosa.load("test.wav", sr=16000)
|
| 59 |
+
|
| 60 |
+
inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
|
| 61 |
+
|
| 62 |
+
with torch.no_grad():
|
| 63 |
+
outputs = model(**inputs)
|
| 64 |
+
|
| 65 |
+
embedding = outputs.last_hidden_state.mean(dim=1)
|
| 66 |
+
prob = torch.sigmoid(embedding.mean()).item()
|
| 67 |
+
|
| 68 |
+
print(prob)
|