nutrivision-app / run_api.py
Omarsy2's picture
Upload 6 files
d182af3 verified
Raw
History Blame Contribute Delete
725 Bytes
"""Run the NutriVision FastAPI server."""
if __name__ == "__main__":
# Check if uvicorn is installed to serve the FastAPI application
try:
import uvicorn
except ImportError:
raise RuntimeError(
"uvicorn is required to run the API. Install it in your environment."
)
# Start the server using uvicorn
# 'nutrivision_api.server:app' points to the FastAPI app instance
# host="0.0.0.0" allows the server to be accessible externally
# port=8000 is the default port for the API
# reload=True enables automatic server restart on code changes (development mode)
uvicorn.run("nutrivision_api.server:app", host="0.0.0.0", port=8000, reload=True)