Spaces:
Build error
Build error
| # AudioForge Backend | |
| FastAPI backend for open-source music generation. | |
| ## Setup | |
| 1. Install dependencies: | |
| ```bash | |
| uv venv | |
| source .venv/bin/activate # Windows: .venv\Scripts\activate | |
| uv pip install -e ".[dev]" | |
| ``` | |
| 2. Set up environment variables: | |
| ```bash | |
| cp .env.example .env | |
| # Edit .env with your settings | |
| ``` | |
| 3. Start PostgreSQL and Redis (using Docker): | |
| ```bash | |
| docker-compose up -d postgres redis | |
| ``` | |
| 4. Run migrations: | |
| ```bash | |
| alembic upgrade head | |
| ``` | |
| 5. Start the server: | |
| ```bash | |
| uvicorn app.main:app --reload | |
| ``` | |
| ## Music Generation Models | |
| ### MusicGen (Required) | |
| MusicGen is used for instrumental music generation. It will be automatically downloaded on first use. | |
| ### Bark (Optional) | |
| Bark is used for vocal generation. To install: | |
| ```bash | |
| pip install bark | |
| ``` | |
| Or use the Hugging Face transformers version: | |
| ```bash | |
| pip install transformers[torch] soundfile | |
| ``` | |
| Then update `app/services/vocal_generation.py` to use the transformers-based implementation. | |
| ## API Documentation | |
| Once running, visit: | |
| - Swagger UI: http://localhost:8000/api/docs | |
| - ReDoc: http://localhost:8000/api/redoc | |
| ## Testing | |
| ```bash | |
| pytest tests/ -v | |
| ``` | |
| ## Development | |
| ```bash | |
| # Format code | |
| make format | |
| # Type check | |
| make type-check | |
| # Lint | |
| make lint | |
| ``` | |