This project is a FastAPI-based machine learning API that provides endpoints for model inference. The setup uses Poetry for dependency management and Alembic for database migrations.
curl -sSL https://install.python-poetry.org | python3 -If you are using Bash, add the following to your ~/.profile or ~/.bashrc:
export PATH="$HOME/.local/bin:$PATH"If you are using Fish, run:
fish_add_path $HOME/.local/bincd backendpoetry new apppip3 install uvicorn gunicorn fastapicd backend/apppoetry add fastapi uvicorn gunicorn pydantic numpy pandas scikit-learn joblib alembic sqlalchemy psycopg2cd backend/apppoetry shellpoetry installalembic revision --autogenerate -m "Initial migration"alembic upgrade headCreate a .env file in backend/app and fill it with values from .env.example.
Set user email and password in .env:
FIRST_SUPERUSER=
FIRST_SUPERUSER_PASSWORD=Then, create the first superuser:
python3 initial_data.py
# or
poetry run python3 initial_data.pyTo test WebSocket, use the following endpoint:
ws://ip:port/api/v1/utils/echo-client/Paste the response in an HTML file and open it in a browser.
To start the FastAPI server, run:
uvicorn app.main:app --reload- 📄 Swagger UI: http://127.0.0.1:8000/docs
- 📘 Redoc: http://127.0.0.1:8000/redoc