Skip to content

Image processing application demo with CloudEvents and TensorFlow

Notifications You must be signed in to change notification settings

fnproject/cloudevents-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudEvents demo

Demo rules: https://github.com/ac360/cloudevents-demo

Configuration

All you need is to put Twitter account credentials to app file. Follow the instructions at https://developer.twitter.com/en/docs/basics/getting-started#get-started-app

How to run

fn -v deploy --all --registry `whoaim`

How to test

Using the following command you can test the application:

curl -v -X POST ${FN_API_URL}/r/cloudevents/cloudevent -d @tweet-entry/payloads/aws.payload.json

Notes

A function that does image processing has a config var: DETECT_SENSITIVITY, it has default value - "0.3", it’s enough to detect most of the objects. However, as lower you go then more objects detected but probability of the correct detection may vary from 0 to 100. So if you want to get more objects detected, just set that to "0.1"

Acceptable payloads

CloudEvent function accepts the following payloads:

Image processing function accepts the following payload:

Setting up functions using Fn CLI (alternative to deploy)

# creates an application
fn apps create cloudevents

# sets application config
fn apps config set cloudevents TWITTER_CONSUMER_KEY ...
fn apps config set cloudevents TWITTER_CONSUMER_SECRET ...
fn apps config set cloudevents TWITTER_ACCESS_TOKEN_KEY ...
fn apps config set cloudevents TWITTER_ACCESS_TOKEN_SECRET ...

fn routes create cloudevents /cloudevent --image denismakogon/tweet-entry:0.0.1 --type async --format json --timeout 60 --idle-timeout 30
fn routes create cloudevents /image-processor --image denismakogon/image-processor:0.0.1 --type async --format json --timeout 3600 --idle-timeout 120 --memory 1024
fn routes config set cloudevents /image-processor DETECT_SENSITIVITY "0.3"