Skip to content

Commit

Permalink
Add Content-Type: application/json in curl examples (#951)
Browse files Browse the repository at this point in the history
* Add Content-Type: application/json in curl examples

* apply suggested change

* style
  • Loading branch information
Wauplin authored Sep 15, 2023
1 parent 4bb6073 commit 0246b40
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/src/lib/inferenceSnippets/serveCurl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ 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}`}"
`;

export const snippetZeroShotClassification = (model: ModelData, accessToken: string): string =>
`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}`}"
`;

Expand Down

0 comments on commit 0246b40

Please sign in to comment.