Spaces:
Sleeping
Sleeping
Create Readme.md
Browse files
Readme.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quran Recitation Comparison API
|
| 2 |
+
|
| 3 |
+
This API allows you to compare two Quran recitations and determine their similarity using deep learning embeddings from the Wav2Vec2 model.
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
|
| 7 |
+
- Compare two audio files of Quran recitations
|
| 8 |
+
- Get a similarity score (0-100) and interpretation
|
| 9 |
+
- Uses Wav2Vec2 embeddings and Dynamic Time Warping (DTW) for comparison
|
| 10 |
+
|
| 11 |
+
## API Endpoints
|
| 12 |
+
|
| 13 |
+
### POST /compare
|
| 14 |
+
|
| 15 |
+
Upload two audio files to compare:
|
| 16 |
+
|
| 17 |
+
```
|
| 18 |
+
curl -X POST "http://localhost:7860/compare" \
|
| 19 |
+
-H "accept: application/json" \
|
| 20 |
+
-H "Content-Type: multipart/form-data" \
|
| 21 |
+
-F "file1=@path/to/first/audio.mp3" \
|
| 22 |
+
-F "file2=@path/to/second/audio.mp3"
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Response:
|
| 26 |
+
```json
|
| 27 |
+
{
|
| 28 |
+
"similarity_score": 60.0,
|
| 29 |
+
"interpretation": "The recitations show moderate similarity."
|
| 30 |
+
}
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
### GET /health
|
| 34 |
+
|
| 35 |
+
Check if the API is healthy and the model is loaded:
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
curl -X GET "http://localhost:7860/health"
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Response:
|
| 42 |
+
```json
|
| 43 |
+
{
|
| 44 |
+
"status": "ok",
|
| 45 |
+
"model_loaded": true
|
| 46 |
+
}
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Setup
|
| 50 |
+
|
| 51 |
+
1. The API requires a Hugging Face token as an environment variable:
|
| 52 |
+
```
|
| 53 |
+
HF_TOKEN=your_hugging_face_token
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
2. The model uses `jonatasgrosman/wav2vec2-large-xlsr-53-arabic` by default.
|
| 57 |
+
|
| 58 |
+
3. Audio files should be in a format supported by librosa (mp3, wav, etc.).
|