Spaces:
Runtime error
Runtime error
File size: 1,494 Bytes
c781b57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Forked: replaces the upstream `kimodo_demo` Viser launch with a Gradio API
# (server.py) used programmatically by the GengaMachines webapp.
set -euo pipefail
cd /workspace
# pre-download checkpoints. We use SOMA-RP-v1.1 (per the integration plan); v1
# is downloaded too for parity with upstream.
python - <<'PY'
from huggingface_hub import snapshot_download
for repo in ("nvidia/Kimodo-SOMA-RP-v1", "nvidia/Kimodo-SOMA-RP-v1.1"):
print(f"snapshot_download({repo}) ...")
snapshot_download(repo)
print("Checkpoint download complete.")
PY
# launch text encoder (internal-only, port 9550)
echo "Starting text-encoder on :9550 ..."
kimodo_textencoder &
TEXT_ENCODER_PID=$!
cleanup() {
echo "Shutting down text-encoder (pid=${TEXT_ENCODER_PID}) ..."
kill "${TEXT_ENCODER_PID}" >/dev/null 2>&1 || true
}
trap cleanup EXIT
# wait for the text encoder to be healthy
echo "Waiting for text-encoder health ..."
for i in $(seq 1 1200); do
if curl -fsS "http://127.0.0.1:9550/" >/dev/null 2>&1; then
echo "Text-encoder is up."
break
fi
sleep 1
if [[ $i -eq 1200 ]]; then
echo "ERROR: text-encoder did not become healthy on http://127.0.0.1:9550/ within 1200s" >&2
exit 1
fi
done
# launch our Gradio API in place of kimodo_demo
echo "Starting Gradio API on :7860 ..."
exec python -u /workspace/server.py
|