Skip to content

Repository files navigation

Calque

Style laid over structure. Calque turns 3D / architectural renders into artistic styles — watercolor, lithograph, anime — while preserving the underlying drawing. A companion tool to Almanach; built for students.

A calque is the transparent overlay an architect traces over a drawing. That is exactly what this tool does: an artistic layer placed over a preserved structure, with control.

Architecture

student browser
   → clawpen.ca / studio.clawpen.ca   (DNS → Cloudflare Tunnel)
   → cloudflared on the GPU host (outbound only — no open ports)
   → orchestrator  (Rust/Axum, :3002)  serves the web UI, proxies /api/*
   → worker        (Python/FastAPI, :8001)  image effects + proxies to ComfyUI
   → ComfyUI       (Python, :8188)   diffusion + ControlNet generation
  • orchestrator/ — Rust/Axum front door. Serves static-site/, exposes /health, proxies /api/* to the worker.
  • worker/ — Python/FastAPI. CPU post-processing effects and a thin HTTP/WS client that drives ComfyUI for GPU generation.
  • ComfyUI/ — headless diffusion server. Runs the actual SD1.5/SDXL checkpoints, LoRAs, ControlNets and preprocessor transformers.
  • static-site/ — single-page web UI (replaces the old tkinter desktop app).
  • desktop/ — Tauri 2 desktop app (see below). Bundles the same UI plus the worker as a sidecar; installs ComfyUI + models on first run.
  • scripts/ — provisioning, model checks, deploy + health-check.
  • .github/workflows/deploy.yml — push to main → self-hosted runner deploys.
  • .github/workflows/release-desktop.yml — tag v* → desktop installers.

Desktop app (for students)

Downloadable builds for Windows (CUDA), CPU (Windows/Linux) and macOS Apple Silicon. The installer is small; on first launch the app downloads Python, PyTorch, ComfyUI and the models (~12 GB, resumable) into the OS app-data folder, then starts everything automatically. Later launches take seconds.

Builds are produced by CI on version tags and attached to a draft GitHub Release. They are unsigned: on Windows click More info → Run anyway, on macOS right-click → Open.

Local build (macOS):

bash scripts/build-worker.sh          # PyInstaller sidecar → desktop/src-tauri/sidecars/
cd desktop && npm install
npx tauri build                        # .app + .dmg in src-tauri/target/release/bundle/

The variant is chosen with Cargo features: variant-macos-mps (default), variant-cuda, variant-cpu — CI builds each with npx tauri build -- --no-default-features --features <variant>.

Develop

macOS / Apple Silicon

Prerequisites: ComfyUI needs Python ≥3.10. macOS system Python (3.9) is too old; use Homebrew Python and pass it to the setup script:

# 1. Install ComfyUI with MPS support
PYTHON=/opt/homebrew/bin/python3 bash scripts/setup-comfyui.sh

# 2. Start ComfyUI (in another shell)
cd ~/ComfyUI && PYTORCH_ENABLE_MPS_FALLBACK=1 ./venv/bin/python main.py --cpu-vae

# 3. Verify / download the models Calque needs
python3 scripts/setup-models.py --comfyui-dir ~/ComfyUI

setup-models.py reports missing checkpoints/LoRAs; download those manually from CivitAI/HuggingFace before /generate will work.

# 4. Worker
cd worker && python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn calque.server:app --host 127.0.0.1 --port 8001

# 5. Orchestrator (another shell)
cargo build --release -p calque-orchestrator
./target/release/calque-orchestrator     # serves http://localhost:3002

Or open all three services at once with:

bash scripts/dev-start-macos.sh

Open http://localhost:3002 — the UI proxies to the worker, which proxies to ComfyUI.

Windows + WSL2

# 1. Install ComfyUI with CUDA support
bash scripts/setup-comfyui.sh

# 2. Start ComfyUI (in another shell)
cd ~/ComfyUI && python main.py

# 3. Verify / download models
python scripts/setup-models.py --comfyui-dir ~/ComfyUI

# 4. Worker
cd worker && python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn calque.server:app --host 127.0.0.1 --port 8001

# 5. Orchestrator
cd orchestrator && cargo run

Deploy (GPU host)

sudo bash scripts/setup-vps.sh      # one-time provisioning
bash scripts/setup-comfyui.sh       # install ComfyUI + controlnets
python scripts/setup-models.py      # verify required models
cp .env.example /opt/calque/.env    # edit
bash /opt/calque/app/scripts/deploy.sh
# then point cloudflared at http://localhost:3002

Status

  • ✅ CPU effects (watercolor / lithograph / anime) served over the web
  • ✅ ComfyUI-backed GPU generation (/generate) on CUDA and Apple Silicon/MPS
  • 🚧 Auth / student accounts (borrow Almanach's pattern when needed)

License

MIT

About

Calque = control-forward. ControlNet + depth/normal/edge maps + post-process compositing lay an artistic style over a preserved structure.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages