This project is part of Project of the Week at DataTalks.Club
I update here my Midterm Project to use FastAPI for serving this model.
Repo contains the following:
README.md
with- Instructions on how to run the project
- Script
train.py
(updated to use Pipeline) - Script
predict.py
(uses FastAPI with Pydantic) - Json files
test.json
andtest2.json
to test the service. Change them to produce another prediction. - Files with dependencies
env_project.yml
conda environment (optional)
All development was done on Windows with conda.
You can either recreate my environment by
conda env create -f env_project.yml
conda activate project
or do it on your own environment.
- Download repo
git clone https://github.com/dimzachar/fastapi_energy_efficiency_buildings
- For the virtual environment, I utilized pipenv. If you want to use the same venv as me, install pipenv and dependencies, navigate to the folder with the given files:
cd fastapi_energy_efficiency_buildings
pip install pipenv
pipenv install numpy pandas seaborn tqdm jupyter scikit-learn==1.1.3 xgboost==1.7.1 pydantic==1.10.2 fastapi uvicorn
- Enter shell
pipenv shell
For the following you need to run train.py
pipenv run python train.py
- Then, get the service running on localhost
pipenv run uvicorn predict:app --reload
and test it with the data in the test.json
and test2.json
on /docs page.
Might try to check if async with await work here like in the BentoML case.
Connect with me: