To launch Caligrafy on Google Cloud, you need to follow these steps:
- Go to the Google Cloud Console (https://console.cloud.google.com) and create a new project.
- 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.
- 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.
- 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.
- 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.
- Configure Caligrafy:
Install Caligrafy locally by following the instructions provided.
Create a config.json file with the following contents:
Replace YOUR_BUCKET_NAME, YOUR_PROJECT_ID, YOUR_TOPIC_NAME, and YOUR_SUBSCRIPTION_NAME with your actual values.
- 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
- 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.