kgbchatbot / app.py
thomascerniglia's picture
Fix launch config for HF Spaces compatibility
29207b9
raw
history blame contribute delete
794 Bytes
import sys, subprocess, os
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
from src.ui.components import build_app
from src.retrieval.vectorstore import VectorStore
from src.retrieval.embedder import get_embedder
from src.config import Settings
from src.utils import ensure_dirs, bootstrap_demo_index
settings = Settings()
ensure_dirs()
# Make sure an index exists (demo index auto-created if empty)
if not os.path.exists(settings.index_path) or not os.path.exists(settings.docs_path):
bootstrap_demo_index()
EMBEDDER = get_embedder(settings)
VSTORE = VectorStore(settings).load()
demo = build_app(settings=settings, embedder=EMBEDDER, vstore=VSTORE)
if __name__ == "__main__":
# Hugging Face Spaces will automatically use correct server settings
demo.launch()