Skip to content

cfernandom/bache-finder-api-ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bache Finder API ML-Project

This project uses a pre-trained Keras model to predict images through a FastAPI endpoint.

NOTE
Copy the model file to the root directory of the project. Ensure the model file is named CNN_BF_PY.h5, or adjust the filename in accordance with your model as specified in the app/core/config.py file.

Setup with Docker

run the following command in the terminal to setup the project:

docker-compose up -d --build

Setup with Virtual Environment

Prerequisites

need to have the following tools installed for h5py:

sudo apt-get install pkg-config
sudo apt-get install libhdf5-dev

Setup

  1. Create a virtual environment:

    python -m venv env
  2. Activate the virtual environment:

    • On Windows:
      .\env\Scripts\activate
    • On Unix or MacOS:
      source env/bin/activate
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Run the FastAPI application:

    python3 -m uvicorn main:app

    or for development with hot reloading:

    uvicorn main:app --reload

Usage

  1. Go to http://127.0.0.1:8000 to see the welcome message.

  2. Use the /predict/ endpoint to make predictions.

    example:

    curl --location 'http://localhost:8000/predict' \
    --form 'file=@"/path_to_img/1_2.jpg"'

    response:

    {"prediction":[[0.13054095208644867,0.13108479976654053,0.14114101231098175,0.09955856949090958,0.11344218999147415,0.06351987272500992,0.03114495612680912,0.08905033767223358,0.03987095132470131,0.07407043874263763,0.08657591044902802]]}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published