# Chatterbox TTS Backend

This directory contains the FastAPI backend for the Chatterbox TTS application.

## Project Structure

- `app/`: Contains the main FastAPI application code.
  - `__init__.py`: Makes `app` a Python package.
  - `main.py`: FastAPI application instance and core API endpoints.
  - `services/`: Business logic for TTS, dialog processing, etc.
  - `models/`: Pydantic models for API request/response.
  - `utils/`: Utility functions.
- `requirements.txt`: Project dependencies for the backend.
- `README.md`: This file.

## Setup & Running

### Prerequisites
- Python 3.8 or higher
- A Python virtual environment (recommended)

### Installation

1. **Navigate to the backend directory**:
   ```bash
   cd /path/to/chatterbox-ui/backend
   ```

2. **Set up a virtual environment** (if not already created):
   ```bash
   python -m venv .venv
   source .venv/bin/activate  # On macOS/Linux
   # .\.venv\Scripts\activate  # On Windows
   ```

3. **Install dependencies**:
   ```bash
   pip install -r requirements.txt
   ```

### Running the Development Server

From the `backend` directory, run:

```bash
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```

### Accessing the API

Once running, you can access:
- API documentation (Swagger UI): `http://127.0.0.1:8000/docs`
- Alternative API docs (ReDoc): `http://127.0.0.1:8000/redoc`
- API root: `http://127.0.0.1:8000/`

### Development Notes
- The `--reload` flag enables auto-reload on code changes
- The server will be accessible on all network interfaces with `--host 0.0.0.0`
- Default port is 8000, but you can change it with `--port <port_number>`
