MooseCP/config.py
2026-07-24 22:24:23 -07:00

49 lines
1.5 KiB
Python

import logging
# --- Server & Logs ---
HOST = "127.0.0.1"
PORT = 8000
LOG_LEVEL = "WARNING" # Options: "DEBUG", "INFO", "WARNING", "ERROR"
LOG_FILE = "debug.log"
USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0"
# --- Model Specific Token Tuning (Tuned for Gemma 4) ---
# Patch size is typically (clip.vision.patch_size * n_merge)
# For Gemma 4, this is 48px.
PATCH_SIZE = 48
# The target token count for a single image preview.
# The actual budget will be this or greater, but as small as possible.
PREVIEW_TOKEN_BUDGET = 70
# Contact sheet grid optimized to fit within Gemma 4's 1120 max token budget
# (10 cols * 7 rows) = 70 images.
# Each thumb (192px) is 4x4 patches.
# 70 images * (4*4) = 1120 tokens.
CONTACT_SHEET_COLS = 10
CONTACT_SHEET_ROWS = 7
CONTACT_SHEET_THUMB_SIZE = 192
# --- Image Quality ---
# JPEG image quality (usually max 95).
# See: https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#jpeg-saving
IMAGE_QUALITY = 95
# --- Font Configuration ---
# Generic font names for cross-platform compatibility
# Pillow's truetype() can often find these by name in the system path
SYSTEM_FONT_NAMES = [
"arialbd.ttf",
"DejaVuSans-Bold",
"LiberationSans-Bold",
"Verdana",
"Tahoma",
]
# Fallback absolute paths for Linux systems
FALLBACK_FONT_PATHS = [
"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",
"/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf",
"/usr/share/fonts/truetype/freefont/FreeSansBold.ttf",
]