Last active
November 16, 2022 01:33
-
-
Save rajshah4/6cde451b7f126aeaa67d89503cba5b93 to your computer and use it in GitHub Desktop.
to_formal formula to call Hugging Inference Endpoints
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function to_formal(input="That was funny LOL") { | |
const endpointUrl = "https://qw2w1h.us-east-1.aws.endpoints.huggingface.cloud"; | |
const options = { | |
"method" : "POST", | |
"contentType" : "application/json", | |
"payload" : JSON.stringify({"inputs": input}), | |
"headers" : { | |
"Authorization" : "Bearer api_org_TOKEN" | |
} | |
}; | |
const response = UrlFetchApp.fetch(endpointUrl, options); | |
const data = JSON.parse(response.getContentText()); | |
const result = data[0]['generated_text'] | |
console.log(result) | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment