#!/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" # onnxruntime-gpu (used by the body-pose estimator) needs the CUDA runtime libs that # ship inside the venv's nvidia-*-cu12 pip packages on the loader path. torch finds # them via RPATH, but onnxruntime does not — so put them on LD_LIBRARY_PATH here. NV_LIBS=$(find "$VENV"/lib/python*/site-packages/nvidia -maxdepth 2 -name lib -type d 2>/dev/null | paste -sd:) [ -n "$NV_LIBS" ] && export LD_LIBRARY_PATH="${NV_LIBS}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" export COMFY_URL="http://127.0.0.1:8188" export HOST="0.0.0.0" export PORT="8500" # A6000 48GB is not VRAM-bound here, so default to a ~2MP output budget. # This comfortably allows full-HD-ish outputs like 1920x1080. # Override via MAX_AREA when needed. export MAX_AREA="${MAX_AREA:-2097152}" # @LEGACY PREVIOUS VERSION # 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