Giter Club home page Giter Club logo

text-extract's Introduction

Text extraction service

Google cloud tutorial

Deployment

  • Create Google Cloud project
  • Enable billing in your account to be able to use most Google Cloud service
  • Enable APIS for the project (Cloud Functions API, Cloud Pub/Sub API, Google Cloud Storage JSON API, Cloud Translation API and Cloud Vision API)
  • Install the gcloud SDK
  • Initialize gcloud: gcloud init
  • Update gcloud and install beta components: gcloud components update && gcloud components install beta
  • Create an input and output bucket: gsutil mb gs://*YOUR_BUCKET_NAME*
  • Configure the app in config.json
  • Deploy image processing function: gcloud functions deploy ocr-extract --runtime nodejs8 --trigger-bucket *YOUR_IMAGE_BUCKET_NAME* --entry-point processImage
  • Deploy text translation function: gcloud functions deploy ocr-translate --runtime nodejs8 --trigger-topic *YOUR_TRANSLATE_TOPIC_NAME* --entry-point translateText
  • Deploy save results function: gcloud functions deploy ocr-save --runtime nodejs8 --trigger-topic *YOUR_RESULT_TOPIC_NAME* --entry-point saveResult
  • Test the service via cmd: gsutil cp *PATH_TO_IMAGE* gs://*YOUR_IMAGE_BUCKET_NAME*
  • Get last logs: gcloud functions logs read --limit 100

Test the code

npm test

text-extract's People

Contributors

gilliswerrebrouck avatar

Watchers

 avatar  avatar

text-extract's Issues

make this better!

https://github.com/GillisWerrebrouck/text-extract/blob/master/index.js#L61-L64

this can be const topicName = config[detection.language === lang ? 'RESULT_TOPIC' : 'TRANSLATE_TOPIC']; dude!!!!

https://github.com/GillisWerrebrouck/text-extract/blob/master/index.js#L100

you dont need to return this resolved promise here!!!!! you can just return it if file.resourceState === 'not_exists'!!!!

https://github.com/GillisWerrebrouck/text-extract/blob/master/index.js#L42

youre using node 8! embrace async await!!!!!! clean up your scope!!!! END MUTATION

https://github.com/GillisWerrebrouck/text-extract/blob/master/index.js#L53-L56

.then(([d]) => {
  const detection = Array.isArray(d) ? d[0] : d;
  ...

duh

https://github.com/GillisWerrebrouck/text-extract/blob/master/index.js#L65-L69

OBJECT SHORT HAND!!!!!!!!!!

const messageData = { text, filename, lang };

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.