How to launch Caligrafy on Google Cloud?

Member

by darion , in category: Third Party Scripts , 6 months ago

How to launch Caligrafy on Google Cloud?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by aubrey , 6 months ago

@darion 

To launch Caligrafy on Google Cloud, you need to follow these steps:

  1. Go to the Google Cloud Console (https://console.cloud.google.com) and create a new project.
  2. Enable the necessary APIs: Go to the APIs & Services section in the console. Click on "+ Enable APIs and Services". Search for "Google Cloud Storage", "Google Cloud Pub/Sub" and enable them.
  3. Set up a storage bucket: Go to the Storage section in the console. Click on "+ Create bucket". Choose a unique name for the bucket and follow the instructions to create it.
  4. Create a Pub/Sub topic and subscription: Go to the Pub/Sub section in the console. Click on "+ Create topic" and give it a name. Once the topic is created, click on it and create a subscription.
  5. Set up a service account and obtain the credentials: Go to the IAM & Admin section in the console. Click on "+ Create service account". Fill in the necessary details and grant the required permissions like Pub/Sub Publisher and Storage Object Creator. Once the service account is created, click on it and click on "+ Create Key". Select JSON as the key type and click on "Create" to download the credentials file.
  6. Configure Caligrafy: Install Caligrafy locally by following the instructions provided. Create a config.json file with the following contents: { "gcs_bucket": "YOUR_BUCKET_NAME", "pubsub_topic": "projects/YOUR_PROJECT_ID/topics/YOUR_TOPIC_NAME", "pubsub_subscription": "projects/YOUR_PROJECT_ID/subscriptions/YOUR_SUBSCRIPTION_NAME" } Replace YOUR_BUCKET_NAME, YOUR_PROJECT_ID, YOUR_TOPIC_NAME, and YOUR_SUBSCRIPTION_NAME with your actual values.
  7. Deploy Caligrafy to Google Cloud Functions: Run the following command in the terminal from the Caligrafy source code folder: gcloud functions deploy caligrafy --runtime python310 --trigger-http --allow-unauthenticated
  8. Test the deployment: Go to the Cloud Functions section in the console. Click on the deployed function (caligrafy) and copy the URL. Send a HTTP POST request to that URL with the document you want to analyze as the request payload.


That's it! Caligrafy is now launched on Google Cloud and ready to analyze your documents.