Spaces:
Runtime error
title: Ishraq Quran Backend
emoji: π
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
Quran Recitation Transcription API
FastAPI backend for Quran recitation transcription using the Faster-Whisper model fine-tuned for Quranic Arabic.
π Quick Start
The easiest way to get started is by using the provided setup script:
# Clone the repository (if you haven't already)
git clone <repository-url>
cd ishraq-al-quran-backend
# Run the setup script
python setup.py
The script will check your environment, install dependencies, and create a default .env file.
Manual Setup
If you prefer to set up manually:
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Start the server
uvicorn main:app --host 0.0.0.0 --port 7860 --reload
The API will be available at http://localhost:7860
π API Documentation
Once running, visit:
- Swagger UI: http://localhost:7860/docs
- ReDoc: http://localhost:7860/redoc
π Endpoints
Health Check
GET /: Basic status checkGET /health: Detailed health check and model status
Transcribe Audio
POST /transcribe: Transcribe a single audio filePOST /transcribe-batch: Transcribe multiple audio files simultaneously
Supported Formats: MP3, WAV, M4A, FLAC, OGG, WEBM, AAC, OPUS.
βοΈ Configuration
The application uses environment variables for configuration. You can customize these in the .env file (see .env.example for all options).
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 7860 |
CORS_ORIGINS |
Allowed CORS origins | http://localhost:3000,http://localhost:5173 |
WHISPER_MODEL |
Hugging Face model ID | Habib-HF/tarbiyah-ai-whisper-medium-merged |
COMPUTE_TYPE |
Precision (float32, float16, int8) |
float32 |
MAX_FILE_SIZE |
Maximum upload size in MB | 100 |
DEVICE |
Computation device (cuda or cpu) |
auto-detect |
π³ Docker Deployment
To run the API using Docker:
# Build and start the container
docker-compose up -d
The Docker setup includes a persistent volume for model caching and automatic health checks.
π― Model Information
Model: Habib-HF/tarbiyah-ai-whisper-medium-merged
- Specifically merged and optimized for Quranic Arabic recitation styles.
- High accuracy for tajweed and specific Quranic terminology.
π§ͺ Testing & Examples
- Test Script: Run
python test_api.pyto verify all endpoints. - Client Examples: See client_examples.py for implementation examples in Python, JavaScript, and cURL.
π Project Structure
ishraq-al-quran-backend/
βββ main.py # FastAPI application & endpoints
βββ config.py # Configuration management
βββ utils.py # Processing utilities
βββ setup.py # Initial setup script
βββ test_api.py # API verification suite
βββ client_examples.py # Library of client implementations
βββ requirements.txt # Project dependencies
For more information, see the main project README.