From 0246b40face824c7082b162988eecc9862462ddd Mon Sep 17 00:00:00 2001 From: Lucain Date: Fri, 15 Sep 2023 07:49:00 +0200 Subject: [PATCH] Add `Content-Type: application/json` in curl examples (#951) * Add Content-Type: application/json in curl examples * apply suggested change * style --- js/src/lib/inferenceSnippets/serveCurl.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/src/lib/inferenceSnippets/serveCurl.ts b/js/src/lib/inferenceSnippets/serveCurl.ts index 4dd44627f..f324cf6ea 100644 --- a/js/src/lib/inferenceSnippets/serveCurl.ts +++ b/js/src/lib/inferenceSnippets/serveCurl.ts @@ -5,6 +5,7 @@ export const snippetBasic = (model: ModelData, accessToken: string): string => `curl https://api-inference.huggingface.co/models/${model.id} \\ -X POST \\ -d '{"inputs": ${getModelInputSnippet(model, true)}}' \\ + -H 'Content-Type: application/json' -H "Authorization: Bearer ${accessToken || `{API_TOKEN}`}" `; @@ -12,6 +13,7 @@ export const snippetZeroShotClassification = (model: ModelData, accessToken: str `curl https://api-inference.huggingface.co/models/${model.id} \\ -X POST \\ -d '{"inputs": ${getModelInputSnippet(model, true)}, "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}' \\ + -H 'Content-Type: application/json' -H "Authorization: Bearer ${accessToken || `{API_TOKEN}`}" `;