Spaces:
Sleeping
Sleeping
Placebo Deploy commited on
Commit ·
04c60b7
1
Parent(s): 57146e3
update
Browse filesFiles changed (2)
- Dockerfile+2-1
- src/app.py+13-9
4 unmodified lines56789105 unmodified lines161718194 unmodified linesRUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"WORKDIR /app5 unmodified linesCOPY --chown=user . /app# Run the FastAPI server on port 7860CMD ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "7860"]4 unmodified lines5678910115 unmodified lines171819204 unmodified linesRUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"ENV PYTHONUNBUFFERED=1WORKDIR /app5 unmodified linesCOPY --chown=user . /app# Run the FastAPI server on port 7860CMD ["uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "7860"]
9 unmodified lines10111213141545 unmodified lines6162636465666768697071727374759 unmodified linesfrom dotenv import load_dotenvimport jwtfrom src.chatbot_engine import MedicalChatbot# Load environment configurationsload_dotenv()45 unmodified lines@asynccontextmanagerasync def lifespan(app: FastAPI):global bottry: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}")yield# Disable default docs to allow our custom /docs route to work9 unmodified lines1011121314151645 unmodified lines6263646566676869707172737475767778799 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 bottry: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 work
Dockerfile+2-1
src/app.py+13-9