Skip to content

dimzachar/fastapi_energy_efficiency_buildings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI for Energy Efficiency of Buildings prediction model

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 and test2.json to test the service. Change them to produce another prediction.
  • Files with dependencies
    • env_project.yml conda environment (optional)

Local deployment

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.

  1. Download repo
git clone https://github.com/dimzachar/fastapi_energy_efficiency_buildings
  1. 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
  1. Enter shell
pipenv shell

For the following you need to run train.py

pipenv run python train.py
  1. 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.

Further development

Might try to check if async with await work here like in the BentoML case.

Connect with me:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages