This commit is contained in:
2026-07-26 23:02:46 -07:00
parent 81fef17af2
commit baa48d7cec
+31 -15
View File
@@ -79,21 +79,37 @@ pip install uvicorn starlette Pillow requests
## Configuration (`config.py`)
You can tune the server's behavior in `config.py`:
Tuning the server's behavior is done via `config.py`.
### Server & Logging
- **`HOST` / `PORT`**: The network address and port the server binds to.
- **`LOG_LEVEL`**: Logging verbosity (`DEBUG`, `INFO`, `WARNING`, `ERROR`).
- **`LOG_FILE`**: Path to the server log file.
- **`USER_AGENT`**: The User-Agent string used for API requests (e.g., Wikipedia). Use a browser-like string to avoid 403 Forbidden errors.
### 🌐 Server & Logging
| Parameter | Description | Default |
| :--- | :--- | :--- |
| `HOST` | The network address the server binds to. | `"127.0.0.1"` |
| `PORT` | The port the server listens on. | `8000` |
| `LOG_LEVEL` | Logging verbosity (`DEBUG`, `INFO`, `WARNING`, `ERROR`). | `"WARNING"` |
| `LOG_FILE` | Absolute path to the server log file. | `ROOT_DIR / "debug.log"` |
| `USER_AGENT` | User-Agent string for API requests (e.g., Wikipedia). | Browser-like string |
### Model & Token Tuning
- **`PATCH_SIZE`**: Set this to `(clip.vision.patch_size * n_merge)` for your specific model to ensure token-perfect resizing.
- **`PREVIEW_TOKEN_BUDGET`**: Controls how many tokens the `preview_image` tool aims for (default: 70).
- **`CONTACT_SHEET_COLS` / `ROWS`**: Adjust the grid size to fit within your model's maximum context window.
- **`CONTACT_SHEET_THUMB_SIZE`**: The pixel size of thumbnails in the contact sheet.
### 🎨 Stable Diffusion Integration
| Parameter | Description | Default |
| :--- | :--- | :--- |
| `SD_URL` | Base URL of the SD WebUI/Forge instance. | `"http://127.0.0.1:7860"` |
| `MODEL_PRESETS_PATH` | Path to the `model_presets.toml` file. | `ROOT_DIR / "model_presets.toml"` |
| `RES_PRESETS_PATH` | Path to the `resolution_presets.toml` file. | `ROOT_DIR / "resolution_presets.toml"` |
| `TAG_DATABASE_PATH` | Path to the Danbooru `tags.csv` file. | (Path to extension folder) |
### Image & Font Settings
- **`IMAGE_QUALITY`**: Adjust JPEG compression (1-100).
- **`SYSTEM_FONT_NAMES`**: A list of font names Pillow should attempt to find in the system path.
- **`FALLBACK_FONT_PATHS`**: Absolute paths to `.ttf` files used if no system fonts are found.
### 🧠 Model & Token Tuning (Optimized for Gemma 4)
| Parameter | Description | Default |
| :--- | :--- | :--- |
| `PATCH_SIZE` | Model's vision patch size in pixels. | `48` |
| `PREVIEW_TOKEN_BUDGET` | Target token count for `preview_image` thumbnails. | `70` |
| `CONTACT_SHEET_COLS` | Number of columns in the contact sheet grid. | `10` |
| `CONTACT_SHEET_ROWS` | Number of rows in the contact sheet grid. | `7` |
| `CONTACT_SHEET_THUMB_SIZE` | Pixel size of thumbnails in the contact sheet. | `192` |
### 🖼️ Image & Font Settings
| Parameter | Description | Default |
| :--- | :--- | :--- |
| `IMAGE_QUALITY` | JPEG compression quality (1-100). | `95` |
| `SYSTEM_FONT_NAMES` | List of font names for Pillow to try in system paths. | Arial, DejaVu, etc. |
| `FALLBACK_FONT_PATHS` | List of absolute paths to `.ttf` files. | Linux-specific paths |