GithubHelp home page GithubHelp logo

jaicie / inception-function Goto Github PK

View Code? Open in Web Editor NEW

This project forked from faas-and-furious/inception-function

0.0 1.0 0.0 328 KB

TensorFlow ImageNet/Inception as an OpenFaaS function

Home Page: https://www.openfaas.com

Python 100.00%

inception-function's Introduction

inception-function

This is a forked version of the work by Magnus Erik Hvass Pedersen - it has been re-packaged as an OpenFaaS serverless function.

This means you can call a HTTP endpoint with a URL to an image and get back categorizations through machine learning - fast.

Changes:

  • Added Dockerfile
  • Download the "image" JPG to local storage instead of loading from local storage

Deploy on OpenFaaS:

$ faas-cli deploy --image alexellis/inception --name inception --fprocess "python3 index.py"

Invoke via curl or faas-cli invoke:

$ URL=https://upload.wikimedia.org/wikipedia/commons/6/61/Humpback_Whale_underwater_shot.jpg \
  echo $URL | faas-cli invoke inception

[{"name": "great white shark", "score": 0.5343291759490967}, {"name": "tiger shark", "score": 0.09276486188173294}, {"name": "grey whale", "score": 0.05899052694439888}, {"name": "sea lion", "score": 0.05105864629149437}, {"name": "hammerhead", "score": 0.019910583272576332}, {"name": "sturgeon", "score": 0.013177040033042431}, {"name": "stingray", "score": 0.00763126602396369}, {"name": "electric ray", "score": 0.006749240681529045}, {"name": "killer whale", "score": 0.005086909048259258}, {"name": "ice bear", "score": 0.003828041721135378}]

Alternatively you can also pipe to jq or invoke via the built-in API Gateway and pick result type "JSON".

  • Use jq tool to filter the top matches:
$ URL=https://upload.wikimedia.org/wikipedia/commons/6/61/Humpback_Whale_underwater_shot.jpg \
  echo $URL | faas-cli invoke inception \
  | jq '.[] | select(.score > 0.05)'

{
  "name": "great white shark",
  "score": 0.5343291759490967
}
{
  "name": "tiger shark",
  "score": 0.09276486188173294
}
{
  "name": "grey whale",
  "score": 0.05899052694439888
}
{
  "name": "sea lion",
  "score": 0.05105864629149437
}

inception-function's People

Contributors

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