Code Monkey home page Code Monkey logo

plantdiseaseapi's Introduction

PlantDiseaseHD API

This is an application that employs a custom machine learning model, utilizing a simple Convolutional Neural Network (CNN), to identify plant diseases through images. The model has been trained with a public dataset from Kaggle.

Prerequisites

You need to have the following tools installed globally on you machine:

  • Python
  • Docker

Installation

Because there is limit of 100MB from github, we need to install the model from this link and move it within app dir. You can use the drive_download.py to download it

Run localy

Build image docker build -t plant_disease .

Run container sudo docker run --name container_plant_disease -p 8000:8000 plant_disease

Deploy on Google Cloud

  • Install Google Cloud CLI

  • Configure the gcloud with the docker

    • You’ll need to determine in which location you want to have your container stored. You can find a full list here.
      • sudo gcloud auth configure-docker LOCATION-docker.pkg.dev
  • The next two steps can be done in you GCP UI.

    • Go to the Artifact Registry in the navigation menu and click the button to enable the API. Then, go to the repositories and click Create Repository button. In the pop-up menu, specify that this is a Docker repository and set its location equal to the previously selected one.
  • The next step is tag the image with appropriate name and to push it. The commands will take some time to execute but once it’s done, you’ll be able see your Docker image in your Artifact Registry UI. the commands are:

    • docker tag IMAGE-NAME LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE-NAME
    • docker push LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE-NAME
  • The last step is to deploy the image on cloud run. The actual deployment step is relatively easy with GCP. The only thing you need to take care of is to enable the Cloud Run API in your GCP project by going to the Cloud Run section in navigation menu and clicking on the button to enable the API. This command will create a default-service (a.k.a our API) from the previously uploaded image in the Artifact Registry. In addition, it also specifies the region (the same as our Docker image), the port to expose, and the RAM available to the service.

    gcloud run deploy default-service \ 
    --image LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE-NAME \
    --region LOCATION \
    --port 8000 \
    --memory 3Gi``
    

plantdiseaseapi's People

Contributors

7131hdmc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.