Giter VIP home page Giter VIP logo

predict-api's Introduction

Prediction API

  • Build Pipeline: Build Status
  • Test Pipeline: Build Status

Latest image on Docker Hub

Create config.json

To connect the API with the right model, you need to specify its location in the config.json file in root of the project. It looks like this:

{
    "model_url": "https://your.model.url",
    "filepath": "endpoints/data/",
    "update_key": "LEMKLZSNWUGKLKGEWHSLAWFUWLGYWLZWJW"
}

Docker Container

This setup requires Docker to run on your PC. I've used Windows and Powershell or the terminal on Mac to run the commands. You can find the downloads for Windows and Mac at the respective links.

The Create an image from the Flask service and run it and upload it as a web service, follow these steps:

Build the image by running:

docker build -t <image-name> .

Where -t is used to set the tag for the image to create. The dot (.) at the end refers to the file path of the Dockerfile. For the build to work, the whole path can't contain any spaces. Something like C:\test would be fine, but "C:\test\this app" wouldn't be.

An example:

docker build -t flask-rest .

Run the container locally:

docker run -p 8000:8000 <image-name>

The property -p sets the port mapping for the container. As the script exposes port 8000, this should be mapped to another port of the container. You might change the second value (right) to change the port to speak to.

An example:

docker run -p 8000:8000 flask-rest

[Option 1/2] Upload image to Docker Hub:

  1. Login to docker from command line

    docker login --username <docker-id> --password <docker-hub-password>
    

    It is more secure, to use --password-stdin to login to your docker account:

    $ cat ~/my_password.txt | docker login --username foo --password-stdin
    

    More information can be found in the Docker Docs

  2. Push the image to Docker Hub:

    docker push <docker-id>/<name-of-image>:v1.0.0 .
    

[Option 2/2] Upload image to Azure Container Registry

  1. Prepare for upload:

    pip install --user azure-cli

    If this doesn't work, download the installer and follow the instructions up on Azure Docs

  2. Login to your container registry:

    docker login <acr-name>.azurecr.io 
    
  3. Push to your registry:

    docker tag <image-name> <acr-name>.azurecr.io/<repo-name>
    docker push awesome.azurecr.io/<repo-name>
    

    More info in the Azure Docs

predict-api's People

Contributors

starlord-daniel avatar

Stargazers

 avatar

Watchers

 avatar  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.