@@ -27,9 +27,9 @@ export const snippetBasic = (
2727 return [
2828 ...( model . pipeline_tag && model . pipeline_tag in HFJS_METHODS
2929 ? [
30- {
31- client : "huggingface.js" ,
32- content : `\
30+ {
31+ client : "huggingface.js" ,
32+ content : `\
3333import { HfInference } from "@huggingface/inference";
3434
3535const client = new HfInference("${ accessToken || `{API_TOKEN}` } ");
@@ -42,8 +42,8 @@ const output = await client.${HFJS_METHODS[model.pipeline_tag]}({
4242
4343console.log(output)
4444` ,
45- } ,
46- ]
45+ } ,
46+ ]
4747 : [ ] ) ,
4848 {
4949 client : "fetch" ,
@@ -214,8 +214,8 @@ export const snippetZeroShotClassification = (model: ModelDataMinimal, accessTok
214214 }
215215
216216 query({"inputs": ${ getModelInputSnippet (
217- model
218- ) } , "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}).then((response) => {
217+ model
218+ ) } , "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}).then((response) => {
219219 console.log(JSON.stringify(response));
220220 });` ,
221221 } ,
@@ -241,15 +241,14 @@ const image = await client.textToImage({
241241 parameters: { num_inference_steps: 5 },
242242 provider: "${ provider } ",
243243});
244-
245244/// Use the generated image (it's a Blob)
246245` ,
247246 } ,
248247 ...( provider === "hf-inference"
249248 ? [
250- {
251- client : "fetch" ,
252- content : `async function query(data) {
249+ {
250+ client : "fetch" ,
251+ content : `async function query(data) {
253252 const response = await fetch(
254253 "https://api-inference.huggingface.co/models/${ model . id } ",
255254 {
@@ -267,8 +266,8 @@ const image = await client.textToImage({
267266query({"inputs": ${ getModelInputSnippet ( model ) } }).then((response) => {
268267 // Use image
269268});` ,
270- } ,
271- ]
269+ } ,
270+ ]
272271 : [ ] ) ,
273272 ] ;
274273} ;
0 commit comments