This application demonstrates how you can integrate Text Summarization inside a Google Doc. It uses a Cloud Function that we have deployed Text Predict Cloud Function.
The summarization inside the Google Doc is demonstrated in the screenshot below:
The summarization in Google Doc is dependent on successful deployment of Text Predict Cloud Function. Ensure that you have followed the instructions to deploy the predictText
Cloud Function.
The Cloud Function on successful deployment will be available at the following URL:
https://$GCP_REGION-$GCP_PROJECT.cloudfunctions.net/predictText
The function works as follows:
- Accepts a JSON data request as a POST method to the above url in the following format:
{"prompt":"YOUR_PROMPT"}
- Returns back a JSON response in the following format :
{"response_text":"YOUR_PROMPT_RESPONSE"}
- Make a copy of the Gen AI Text Summarization - Google Doc Integration document.
- From the main menu, click on
Extensions --> Apps Script
. This will open up the Apps Script editor and you can take a look at the code. - The code works as follows:
- The selected text that the user wants to summarize is first identified.
- This text is then sent via a Prompt to summarize it to the
predictText
Cloud Function. - The result is then displayed in the form of a Summary paragraph.
- Type in the text that you would like to summarize. A sample paragraph is provided but you can have any other text too.
- Select the text to summarize.
- From the main menu, click on
Custom Menu --> Summarize Selected Paragraph
. - This will invoke the
predictText
Cloud Function, retrieve the result and add the Summary paragraph in the document.