|
Download README_API.md from alkasima/alkvoice: direct link, hf CLI and curl.
- Browser
- Download file 4.4 kB
-
https://huggingface.co/spaces/alkasima/alkvoice/resolve/main/README_API.md
- Command line
-
hf download hf://spaces/alkasima/alkvoice/README_API.md
-
curl -L -o README_API.md https://huggingface.co/spaces/alkasima/alkvoice/resolve/main/README_API.md
4.4 kB
| title: AI Voice Enhancer API | |
| emoji: ποΈ | |
| colorFrom: purple | |
| colorTo: blue | |
| sdk: gradio | |
| sdk_version: "5.50.0" | |
| app_file: app_wrapper.py | |
| pinned: false | |
| # ποΈ AI Voice Enhancer API | |
| Professional podcast-quality audio enhancement powered by AI. This Space provides a **REST API** for audio processing. | |
| ## π Quick Start | |
| ### For End Users (with Frontend) | |
| 1. **Download** the frontend from the repository | |
| 2. **Open** `frontend/index.html` in your browser | |
| 3. **Configure** API URL to this Space: `https://YOUR-SPACE-NAME.hf.space` | |
| 4. **Upload** audio and enhance! | |
| ### For Developers (API Integration) | |
| ```bash | |
| curl -X POST "https://YOUR-SPACE-NAME.hf.space/enhance" \ | |
| -F "file=@input.wav" \ | |
| -F "speech_level=80" \ | |
| -F "background_level=85" \ | |
| -o enhanced.wav | |
| ``` | |
| ## π‘ API Endpoints | |
| | Endpoint | Method | Description | | |
| |----------|--------|-------------| | |
| | `/` | GET | API information | | |
| | `/health` | GET | Health check | | |
| | `/enhance` | POST | Enhance audio file | | |
| | `/cleanup` | DELETE | Clean temp files | | |
| ## ποΈ Parameters | |
| ### POST /enhance | |
| - **file**: Audio file (WAV, MP3, M4A, FLAC, OGG, AAC) | |
| - **speech_level**: 0-100 (default: 80) - Voice clarity | |
| - **background_level**: 0-100 (default: 85) - Noise reduction | |
| ## π― Features | |
| - β **Noise Suppression**: Facebook Denoiser (DNS) + FFmpeg | |
| - β **Clarity Enhancement**: Multi-stage EQ, compression, de-essing | |
| - β **Loudness Normalization**: EBU R128 standard (-16 LUFS) | |
| - β **Adjustable Processing**: Fine-tune enhancement levels | |
| - β **CPU Optimized**: Runs on free Spaces | |
| - β **CORS Enabled**: Works with any frontend | |
| ## π§ Technical Details | |
| ### Audio Processing Pipeline: | |
| 1. **Validation** - Check format, duration, file size | |
| 2. **Noise Suppression** - DNS model or FFmpeg afftdn | |
| 3. **Clarity Enhancement** - EQ, gate, compression, de-esser | |
| 4. **Normalization** - EBU R128 loudness standard | |
| ### Processing Time: | |
| - 10-second audio: ~15-30 seconds | |
| - 60-second audio: ~60-120 seconds | |
| - Depends on CPU availability | |
| ## π Quality | |
| Targets 80-90% of Adobe Podcast Enhance Speech quality: | |
| | Feature | Adobe Podcast | This API | | |
| |---------|--------------|----------| | |
| | Noise Removal | βββββ | ββββ | | |
| | Clarity | βββββ | ββββ | | |
| | Speed | βββ | ββββ | | |
| | Cost | π°π°π° | Free β | | |
| ## π» Example: Python Client | |
| ```python | |
| import requests | |
| class VoiceEnhancer: | |
| def __init__(self, api_url): | |
| self.api_url = api_url | |
| def enhance(self, audio_file, speech=80, background=85): | |
| url = f"{self.api_url}/enhance" | |
| files = {"file": open(audio_file, "rb")} | |
| data = { | |
| "speech_level": speech, | |
| "background_level": background | |
| } | |
| response = requests.post(url, files=files, data=data) | |
| if response.ok: | |
| return response.content | |
| else: | |
| raise Exception(f"Enhancement failed: {response.text}") | |
| # Usage | |
| enhancer = VoiceEnhancer("https://YOUR-SPACE-NAME.hf.space") | |
| enhanced_audio = enhancer.enhance("input.wav", speech=80, background=85) | |
| with open("output.wav", "wb") as f: | |
| f.write(enhanced_audio) | |
| ``` | |
| ## π Limitations | |
| - **Duration**: Max 60 seconds | |
| - **File Size**: Max 50MB | |
| - **Concurrent Users**: Limited on free tier | |
| - **Processing Speed**: Depends on CPU availability | |
| ## π οΈ Tech Stack | |
| - **API Framework**: FastAPI + Uvicorn | |
| - **Audio Processing**: | |
| - PyTorch + Torchaudio | |
| - Facebook Denoiser (DNS) | |
| - FFmpeg (filters, normalization) | |
| - **ML Model**: DNS64 (pretrained) | |
| ## π¦ Deployment | |
| This Space runs: | |
| - FastAPI server on port 7860 | |
| - Gradio info page on port 7861 (this page) | |
| The actual audio processing happens via the FastAPI endpoints. | |
| ## π Privacy | |
| - No data stored permanently | |
| - Temporary files auto-deleted after 30 minutes | |
| - No analytics or tracking | |
| - Processes on-server (no external APIs) | |
| ## π License | |
| MIT License - Free to use, modify, and distribute. | |
| ## π Acknowledgments | |
| - **Facebook AI**: For Denoiser library | |
| - **FFmpeg**: For robust audio tools | |
| - **Hugging Face**: For free hosting | |
| --- | |
| **Repository**: [GitHub Link Here] | |
| **Frontend**: Download from repository | |
| **Support**: Open an issue on GitHub | |