Virtual-try-on / app /main.py
Hammad712's picture
Update app/main.py
98ccc92 verified
import uvicorn
import logging
import sys
from fastapi import FastAPI
from app.api.image_router import router as image_router
# --- Logging Configuration ---
# We configure logging to output to stdout (standard output)
# This is best practice for services, as the environment (like Docker or Uvicorn)
# can then capture and manage the logs.
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[logging.StreamHandler(sys.stdout)]
)
# ---
# Get a logger for this file
logger = logging.getLogger(__name__)
# Initialize the FastAPI app
app = FastAPI(title="Image Generation & Update API")
# Include your API routers
app.include_router(image_router)
hi
# 1. Root endpoint
@app.get("/")
async def root():
logger.info("Root endpoint '/' was hit")
return {"message": "Welcome to the Image Generation API! Visit /docs for API documentation."}
# --- Run the app ---
if __name__ == "__main__":
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=True)