Spaces:
Sleeping
Sleeping
| """ | |
| Servidor API REST para RAG Template. | |
| Executa servidor FastAPI/Uvicorn. | |
| """ | |
| import uvicorn | |
| import os | |
| from dotenv import load_dotenv | |
| # Carregar variaveis de ambiente | |
| load_dotenv() | |
| if __name__ == "__main__": | |
| # Configuracoes | |
| host = os.getenv("API_HOST", "0.0.0.0") | |
| port = int(os.getenv("API_PORT", "8000")) | |
| reload = os.getenv("API_RELOAD", "false").lower() == "true" | |
| workers = int(os.getenv("API_WORKERS", "1")) | |
| print(f"Starting RAG Template API server at http://{host}:{port}") | |
| print(f"API docs available at http://{host}:{port}/api/docs") | |
| # Executar servidor | |
| uvicorn.run( | |
| "src.api:app", | |
| host=host, | |
| port=port, | |
| reload=reload, | |
| workers=workers, | |
| log_level="info" | |
| ) | |