GithubHelp home page GithubHelp logo

lance / twitter-translate-orchestration Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 166 KB

5 minute lightning talk on building a Twitter translation bot with Knative Functions

JavaScript 76.95% Go 18.31% Shell 4.74%

twitter-translate-orchestration's Introduction

KubeCon NA 2022 - Build a Twitter Translate Bot in 5 Minutes

This demo converts tweets into English using Camel-K and Knative.

It uses a Camel-K Kamelet to periodically search Twitter for [some value]. The Kamelet converts each tweet into a CloudEvent, sending it to the default Knative Broker. A translate function receives these events via a Trigger between the Broker and the function which filters for these types of events.

The translate function inspects the tweet language and if it's English, it simply returns the tweet text as the data for a translation event. If it's not English, the Google Translation API is used to convert the tweet text to English, and the result is returned as the data in the translation event.

A viewer function is deployed to listen for translation events and display them in the logs.

System diagram

Prerequisites

Steps

  • Deploy the translate and viewer functions
func deploy -p viewer
func deploy -p translate
  • Install a default Knative Broker
kn broker create default
  • Create the Tweet->Translate trigger
kn trigger create twitter-trigger -s translate --filter type=twitter.search.source
  • Create the Translation->Viewer trigger
kn trigger create translate-trigger -s viewer --filter type=knative.function.translation
  • Install the Kamelet
kubectl apply -f resources/twitter-search-source-binding-v1.yaml
  • Check the logs
k logs -l app=viewer --tail 10 -f
  • Cleanup
./resources/teardown.sh

twitter-translate-orchestration's People

Contributors

lance avatar

Stargazers

John Gentilin avatar Arun M. Krishnakumar avatar Jeremiah LaPierre avatar AT Will 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.