#!/bin/bash
# Launch the FastAPI edit service (talks to the local ComfyUI on :8188).
# Reuses tour-comfy/edit_api.py + workflow verbatim (they're backend-agnostic).
set -e
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env.sh"
source "$VENV/bin/activate"
cd "$API_DIR"

export COMFY_URL="http://127.0.0.1:8188"
export HOST="0.0.0.0"
export PORT="8500"
# The A6000 is fast and not VRAM-bound on this model, so default to a full ~1MP
# output budget (tour caps at 0.65MP to survive the MI50). Override via MAX_AREA.
export MAX_AREA="${MAX_AREA:-1048576}"

exec python edit_api.py
