Skip to content

Instantly share code, notes, and snippets.

@rajshah4
Last active Nov 16, 2022
Embed
What would you like to do?
to_formal formula to call Hugging Inference Endpoints
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