CoolFace
Apppublic

Area51base/cc-chatbot

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
start_render.sh33 linesDownload Raw Back to root
1#!/usr/bin/env bash2# ─────────────────────────────────────────────────────────────────────────────3# start_render.sh — HF Spaces / Render deployment startup4# Starts Streamlit IMMEDIATELY (opens port), runs ingestion + API in background5# ─────────────────────────────────────────────────────────────────────────────6export CHROMA_PERSIST_DIR="${CHROMA_PERSIST_DIR:-/tmp/chroma_db}"7mkdir -p "$CHROMA_PERSIST_DIR"8 9echo "=== CC AI Chatbot — Startup ==="10echo "PORT: ${PORT:-8501}"11echo "CHROMA_PERSIST_DIR: $CHROMA_PERSIST_DIR"12 13# ── Step 1: Run ingestion + start FastAPI in background ───────────────────────14(15    echo ">>> Background: running data ingestion..."16    python scripts/ingest.py > /tmp/ingest.log 2>&117    echo ">>> Background: ingestion done. Starting FastAPI on :8000..."18    uvicorn cc_chatbot.main:app --host 0.0.0.0 --port 8000 \19        --log-level warning > /tmp/api.log 2>&120) &21 22# ── Step 2: Start Streamlit immediately in foreground ─────────────────────────23# HF Spaces needs port open within ~30s; Streamlit opens instantly.24# The UI shows "Thinking..." until the API is ready (auto-retries).25echo ">>> Starting Streamlit UI on port ${PORT:-8501}..."26exec streamlit run ui/streamlit_app.py \27    --server.port "${PORT:-8501}" \28    --server.address 0.0.0.0 \29    --server.headless true \30    --server.enableCORS false \31    --server.enableXsrfProtection false32 33