Spaces:
Sleeping
Sleeping
| title: XTTS C3PO Voice Cloning API | |
| emoji: π€ | |
| colorFrom: indigo | |
| colorTo: yellow | |
| sdk: docker | |
| pinned: false | |
| # π€ C-3PO TTS API | |
| A FastAPI-based text-to-speech service using the **C-3PO fine-tuned XTTS v2 model** from [Borcherding/XTTS-v2_C3PO](https://huggingface.co/Borcherding/XTTS-v2_C3PO) for authentic C-3PO voice synthesis. | |
| ## β¨ Features | |
| - π€ **Authentic C-3PO Voice**: Fine-tuned XTTS v2 model with 20 unique C-3PO voice lines | |
| - π **17+ Languages**: Multilingual support while maintaining C-3PO characteristics | |
| - π **Voice Cloning**: Optional custom voice cloning capabilities | |
| - π **FastAPI**: Modern API with automatic documentation | |
| - π³ **Docker Ready**: Containerized for easy deployment | |
| ## π Quick Start | |
| ### Docker Deployment | |
| ```bash | |
| # Build the container | |
| docker build -t c3po-tts . | |
| # Run the container | |
| docker run -p 7860:7860 c3po-tts | |
| ``` | |
| ### Local Development | |
| ```bash | |
| # Install dependencies | |
| pip install -r requirements.txt | |
| # Run the API | |
| python coqui_api.py | |
| ``` | |
| The API will be available at `http://localhost:7860` | |
| ## π‘ API Endpoints | |
| ### C-3PO Text-to-Speech | |
| ```bash | |
| curl -X POST "http://localhost:7860/tts-c3po" \ | |
| -F "text=I am C-3PO, human-cyborg relations." \ | |
| -F "language=en" \ | |
| --output c3po_voice.wav | |
| ``` | |
| ### General Text-to-Speech (with C-3PO voice by default) | |
| ```bash | |
| curl -X POST "http://localhost:7860/tts" \ | |
| -F "text=The odds of successfully navigating an asteroid field are approximately 3,720 to 1." \ | |
| -F "language=en" \ | |
| --output c3po_output.wav | |
| ``` | |
| ### JSON API | |
| ```bash | |
| curl -X POST "http://localhost:7860/tts-json" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"text": "R2-D2, you know better than to trust a strange computer!", "language": "en"}' \ | |
| --output c3po_json.wav | |
| ``` | |
| ### Health Check | |
| ```bash | |
| curl http://localhost:7860/health | |
| ``` | |
| ## π Supported Languages | |
| English, Spanish, French, German, Italian, Portuguese, Polish, Turkish, Russian, Dutch, Czech, Arabic, Chinese, Japanese, Hungarian, Korean, Hindi | |
| ## π¨ Example C-3PO Phrases | |
| Perfect texts for demonstrating C-3PO's voice: | |
| - "I am C-3PO, human-cyborg relations." | |
| - "The odds of successfully navigating an asteroid field are approximately 3,720 to 1." | |
| - "R2-D2, you know better than to trust a strange computer!" | |
| - "Oh my! How interesting!" | |
| ## π API Documentation | |
| Visit `http://localhost:7860/docs` for interactive API documentation. | |
| ## π§ͺ Testing | |
| ```bash | |
| # Run the C-3PO test suite | |
| python test_c3po_model.py | |
| ``` | |
| ## π§ Configuration | |
| The API automatically downloads the C-3PO model on first run. Environment variables: | |
| - `COQUI_TOS_AGREED=1`: Accepts Coqui TTS terms | |
| - `HF_HUB_DISABLE_TELEMETRY=1`: Disables telemetry | |
| ## π¦ Files | |
| - `coqui_api.py`: Main C-3PO TTS API | |
| - `test_c3po_model.py`: Test suite for C-3PO functionality | |
| - `start_c3po_api.py`: Startup script with dependency checks | |
| - `Dockerfile`: Container configuration | |
| - `requirements.txt`: Python dependencies | |
| ## π Credits | |
| - [C-3PO Fine-tuned Model](https://huggingface.co/Borcherding/XTTS-v2_C3PO) by Borcherding | |
| - [Coqui TTS](https://github.com/coqui-ai/TTS) - The underlying TTS engine | |
| - [FastAPI](https://fastapi.tiangolo.com/) - Web framework | |