Spaces:
Runtime error
Runtime error
Placebo Deploy commited on
Commit ·
a7ffd76
1
Parent(s): 2d00072
update
Browse filesFiles changed (2)
- Dockerfile+2-1
- src/app.py+13-9
4 unmodified lines5678910115 unmodified lines17181919204 unmodified linesRUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"ENV PYTHONUNBUFFERED=1
WORKDIR /app
5 unmodified linesCOPY --chown=user . /app
# Run the FastAPI server on port 7860CMD ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "7860"]CMD ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "7860"]9 unmodified lines1011121314151645 unmodified lines6263646564656667686970717266676869707172737475767778799 unmodified linesfrom dotenv import load_dotenvimport jwtfrom src.chatbot_engine import MedicalChatbotimport asyncio
# Load environment configurationsload_dotenv()45 unmodified lines
@asynccontextmanagerasync def lifespan(app: FastAPI): async def init_bot(): global bot try: print("Initializing Medical Chatbot Engine...") bot = MedicalChatbot() print("--- VECTOR STORE VERIFICATION ---") print("Skipped verification search during startup to prevent boot hanging (useful when Ollama is processing background ingestion tasks).") print("---------------------------------") except Exception as e: print(f"Chatbot initialization error: {e}") global bot try: print("Initializing Medical Chatbot Engine in background...", flush=True) bot = await asyncio.to_thread(MedicalChatbot) print("--- VECTOR STORE VERIFICATION ---", flush=True) print("Skipped verification search during startup to prevent boot hanging.", flush=True) print("---------------------------------", flush=True) except Exception as e: print(f"Chatbot initialization error: {e}", flush=True) asyncio.create_task(init_bot()) yield
# Disable default docs to allow our custom /docs route to workDockerfile+2-1
src/app.py+13-9