moazx's picture
Update .env.example with OpenAI and LangSmith configuration, modify app.py to dynamically set the port for deployment, enhance CORS middleware to support additional local development origins, and improve document retrieval settings for more comprehensive context in responses.
0a5dcf9
raw
history blame
647 Bytes
"""
Startup script for Medical RAG AI Advisor API
"""
import sys
import os
import uvicorn
# Add core to Python path
sys.path.append(os.path.join(os.path.dirname(__file__), 'core'))
if __name__ == "__main__":
# Get port from environment variable (Hugging Face uses PORT env var)
port = int(os.environ.get("PORT", 7860))
uvicorn.run(
"api.app:app",
host="0.0.0.0", # Bind to all interfaces for deployment
port=port,
reload=False, # Disable reload in production for faster startup
log_level="info",
access_log=True,
workers=1 # Single worker for Hugging Face Spaces
)