from fastapi import FastAPI from src.app.api.predict import router as transportation_router from src.app.api.chat import router as chat_router from src.config.logging_config import setup_logging, get_logger # Setup logging trước khi khởi tạo app setup_logging() logger = get_logger(__name__) app = FastAPI( title="Transportation Prediction API", description="API dự đoán phương thức vận chuyển dùng mô hình XGBoost với đầu vào đơn giản", version="2.0.0" ) logger.info("Starting Transportation Prediction API v2.0") # New simplified API endpoint app.include_router(transportation_router, prefix="/api", tags=["transportation"]) app.include_router(chat_router, prefix="/api", tags=["chat"]) @app.get("/") def root(): return { "message": "Transportation Prediction API v2.0", "docs": "/docs", "endpoints": { "predict_transportation": "/api/predict-transportation", "transportation_options": "/api/transportation-options", "legacy_predict": "/api/predict", "chat": "/api/chat (streaming)" }, "description": "Sử dụng /api/predict-transportation với đầu vào đơn giản để dự đoán phương thức vận chuyển, hoặc /api/chat để chat với AI (streaming response)" } # Only run server if this file is executed directly if __name__ == "__main__": import uvicorn logger.info("Starting server on localhost:3454") uvicorn.run(app, host="localhost", port=3454)