|

Master the Art of Summarizing: How to Get More Done in Less Time

We exist at a interesting point in the flow of time.

With the advancement of technology, attention can view as the new commodities today (aka attention deficit economy).

Fortunately, we are blessed with the advances of AI where we just have to source for way to incorporate it to assist us in our daily pursuit. 

Hence, creating this summary below is very possible and as simple as it is. Done through 1 wonderful services – Google Sheet and a open source AI Model hub place – HuggingFace

Start by getting the api keys (Access Token) from huggingface.co

Following that, replace the hf_xxxxx with the said access token in code below – 

// Huggingface summariser

function SUMMARY(input, repo_id="facebook/bart-large-cnn") {
  endpoint = "https://api-inference.huggingface.co/models/" + repo_id;
  const payload = JSON.stringify({
    "inputs": input
     });

  // Add your token from https://huggingface.co/settings/token
  const options = {
      "headers":  {"Authorization": "Bearer hf_XXXXXX"},
      "wait_for_model": true,
      "use_gpu": false,
      "method" : "POST",
      "contentType" : "application/json",
      "payload" : payload,
  };

  const response = UrlFetchApp.fetch(endpoint, options);
  const data = JSON.parse(response.getContentText());
  return data[0].summary_text;
  }

Next, launch the google sheets and to get to the Apps Script function.

Paste the said code above into Apps Script and define your function like I have define mine as AL_SUMMARY and make sure you save it.

Next just do call your function as what I have demonstrated below using AL_SUMMARY

Volia – you get your summary 

All above-mentioned was something I always wanted to do before I get to encounter “AI”, and now make possible and I will like share this with all that need it.

As always have fun and stay inspired.

Similar Posts