From dfcc68b579cf4d03c0664b0a1896aadbf112f650 Mon Sep 17 00:00:00 2001 From: hanouticelina <36770234+hanouticelina@users.noreply.github.com> Date: Tue, 26 Nov 2024 03:12:22 +0000 Subject: [PATCH] Update API inference documentation (automated) --- docs/api-inference/tasks/audio-classification.md | 4 ++-- .../tasks/automatic-speech-recognition.md | 4 ++-- docs/api-inference/tasks/chat-completion.md | 4 ++-- docs/api-inference/tasks/feature-extraction.md | 4 ++-- docs/api-inference/tasks/fill-mask.md | 4 ++-- docs/api-inference/tasks/image-classification.md | 4 ++-- docs/api-inference/tasks/image-segmentation.md | 4 ++-- docs/api-inference/tasks/image-text-to-text.md | 4 ++-- docs/api-inference/tasks/object-detection.md | 4 ++-- docs/api-inference/tasks/question-answering.md | 5 ++--- docs/api-inference/tasks/summarization.md | 4 ++-- docs/api-inference/tasks/table-question-answering.md | 11 +++++------ docs/api-inference/tasks/text-classification.md | 4 ++-- docs/api-inference/tasks/text-generation.md | 4 ++-- docs/api-inference/tasks/text-to-image.md | 4 ++-- docs/api-inference/tasks/token-classification.md | 4 ++-- docs/api-inference/tasks/translation.md | 4 ++-- docs/api-inference/tasks/zero-shot-classification.md | 4 ++-- scripts/api-inference/package.json | 2 +- scripts/api-inference/pnpm-lock.yaml | 10 +++++----- 20 files changed, 45 insertions(+), 47 deletions(-) diff --git a/docs/api-inference/tasks/audio-classification.md b/docs/api-inference/tasks/audio-classification.md index 8f8f80cac..46e8d6b54 100644 --- a/docs/api-inference/tasks/audio-classification.md +++ b/docs/api-inference/tasks/audio-classification.md @@ -43,7 +43,7 @@ Explore all available models and find the one that suits you best [here](https:/ curl https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition \ -X POST \ --data-binary '@sample1.flac' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -74,7 +74,7 @@ async function query(filename) { "https://api-inference.huggingface.co/models/ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/automatic-speech-recognition.md b/docs/api-inference/tasks/automatic-speech-recognition.md index 15d5d0556..c671d7f88 100644 --- a/docs/api-inference/tasks/automatic-speech-recognition.md +++ b/docs/api-inference/tasks/automatic-speech-recognition.md @@ -44,7 +44,7 @@ Explore all available models and find the one that suits you best [here](https:/ curl https://api-inference.huggingface.co/models/openai/whisper-large-v3 \ -X POST \ --data-binary '@sample1.flac' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -75,7 +75,7 @@ async function query(filename) { "https://api-inference.huggingface.co/models/openai/whisper-large-v3", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/chat-completion.md b/docs/api-inference/tasks/chat-completion.md index 2a1377e6b..86e797b84 100644 --- a/docs/api-inference/tasks/chat-completion.md +++ b/docs/api-inference/tasks/chat-completion.md @@ -62,7 +62,7 @@ The API supports: ```bash curl 'https://api-inference.huggingface.co/models/google/gemma-2-2b-it/v1/chat/completions' \ --H "Authorization: Bearer hf_***" \ +-H 'Authorization: Bearer hf_***' \ -H 'Content-Type: application/json' \ --data '{ "model": "google/gemma-2-2b-it", @@ -209,7 +209,7 @@ To use the JavaScript client, see `huggingface.js`'s [package reference](https:/ ```bash curl 'https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions' \ --H "Authorization: Bearer hf_***" \ +-H 'Authorization: Bearer hf_***' \ -H 'Content-Type: application/json' \ --data '{ "model": "meta-llama/Llama-3.2-11B-Vision-Instruct", diff --git a/docs/api-inference/tasks/feature-extraction.md b/docs/api-inference/tasks/feature-extraction.md index e4cbb5889..29d3ca441 100644 --- a/docs/api-inference/tasks/feature-extraction.md +++ b/docs/api-inference/tasks/feature-extraction.md @@ -44,7 +44,7 @@ curl https://api-inference.huggingface.co/models/thenlper/gte-large \ -X POST \ -d '{"inputs": "Today is a sunny day and I will get some ice cream."}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -74,7 +74,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/thenlper/gte-large", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/fill-mask.md b/docs/api-inference/tasks/fill-mask.md index 3f1ecbd4c..2a5012742 100644 --- a/docs/api-inference/tasks/fill-mask.md +++ b/docs/api-inference/tasks/fill-mask.md @@ -40,7 +40,7 @@ curl https://api-inference.huggingface.co/models/google-bert/bert-base-uncased \ -X POST \ -d '{"inputs": "The answer to the universe is [MASK]."}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -70,7 +70,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/google-bert/bert-base-uncased", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/image-classification.md b/docs/api-inference/tasks/image-classification.md index baab2aa40..748088cd5 100644 --- a/docs/api-inference/tasks/image-classification.md +++ b/docs/api-inference/tasks/image-classification.md @@ -38,7 +38,7 @@ Explore all available models and find the one that suits you best [here](https:/ curl https://api-inference.huggingface.co/models/google/vit-base-patch16-224 \ -X POST \ --data-binary '@cats.jpg' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -69,7 +69,7 @@ async function query(filename) { "https://api-inference.huggingface.co/models/google/vit-base-patch16-224", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/image-segmentation.md b/docs/api-inference/tasks/image-segmentation.md index 6918f0895..b60e81e62 100644 --- a/docs/api-inference/tasks/image-segmentation.md +++ b/docs/api-inference/tasks/image-segmentation.md @@ -39,7 +39,7 @@ Explore all available models and find the one that suits you best [here](https:/ curl https://api-inference.huggingface.co/models/openmmlab/upernet-convnext-small \ -X POST \ --data-binary '@cats.jpg' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -70,7 +70,7 @@ async function query(filename) { "https://api-inference.huggingface.co/models/openmmlab/upernet-convnext-small", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/image-text-to-text.md b/docs/api-inference/tasks/image-text-to-text.md index e23eb5a71..165fc91df 100644 --- a/docs/api-inference/tasks/image-text-to-text.md +++ b/docs/api-inference/tasks/image-text-to-text.md @@ -40,7 +40,7 @@ curl https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision -X POST \ -d '{"inputs": "Can you please let us know more details about your "}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -96,7 +96,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/object-detection.md b/docs/api-inference/tasks/object-detection.md index 527ccc260..a1ca592fa 100644 --- a/docs/api-inference/tasks/object-detection.md +++ b/docs/api-inference/tasks/object-detection.md @@ -38,7 +38,7 @@ Explore all available models and find the one that suits you best [here](https:/ curl https://api-inference.huggingface.co/models/facebook/detr-resnet-50 \ -X POST \ --data-binary '@cats.jpg' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -69,7 +69,7 @@ async function query(filename) { "https://api-inference.huggingface.co/models/facebook/detr-resnet-50", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/question-answering.md b/docs/api-inference/tasks/question-answering.md index 1bf60e26d..0222d8549 100644 --- a/docs/api-inference/tasks/question-answering.md +++ b/docs/api-inference/tasks/question-answering.md @@ -26,7 +26,6 @@ For more details about the `question-answering` task, check out its [dedicated p - [deepset/roberta-base-squad2](https://huggingface.co/deepset/roberta-base-squad2): A robust baseline model for most question answering domains. - [distilbert/distilbert-base-cased-distilled-squad](https://huggingface.co/distilbert/distilbert-base-cased-distilled-squad): Small yet robust model that can answer questions. -- [google/tapas-base-finetuned-wtq](https://huggingface.co/google/tapas-base-finetuned-wtq): A special model that can answer questions from tables. Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=question-answering&sort=trending). @@ -41,7 +40,7 @@ curl https://api-inference.huggingface.co/models/deepset/roberta-base-squad2 \ -X POST \ -d '{"inputs": { "question": "What is my name?", "context": "My name is Clara and I live in Berkeley." }}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -74,7 +73,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/deepset/roberta-base-squad2", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/summarization.md b/docs/api-inference/tasks/summarization.md index 4df607752..b3ac11d4c 100644 --- a/docs/api-inference/tasks/summarization.md +++ b/docs/api-inference/tasks/summarization.md @@ -39,7 +39,7 @@ curl https://api-inference.huggingface.co/models/facebook/bart-large-cnn \ -X POST \ -d '{"inputs": "The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -69,7 +69,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/facebook/bart-large-cnn", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/table-question-answering.md b/docs/api-inference/tasks/table-question-answering.md index 9f409170c..d29e655bc 100644 --- a/docs/api-inference/tasks/table-question-answering.md +++ b/docs/api-inference/tasks/table-question-answering.md @@ -24,7 +24,6 @@ For more details about the `table-question-answering` task, check out its [dedic ### Recommended models -- [google/tapas-base-finetuned-wtq](https://huggingface.co/google/tapas-base-finetuned-wtq): A robust table question answering model. Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=table-question-answering&sort=trending). @@ -35,11 +34,11 @@ Explore all available models and find the one that suits you best [here](https:/ ```bash -curl https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq \ +curl https://api-inference.huggingface.co/models/ \ -X POST \ -d '{"inputs": { "query": "How many stars does the transformers repository have?", "table": { "Repository": ["Transformers", "Datasets", "Tokenizers"], "Stars": ["36542", "4512", "3934"], "Contributors": ["651", "77", "34"], "Programming language": [ "Python", "Python", "Rust, Python and NodeJS" ] } }}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -47,7 +46,7 @@ curl https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq ```py import requests -API_URL = "https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq" +API_URL = "https://api-inference.huggingface.co/models/" headers = {"Authorization": "Bearer hf_***"} def query(payload): @@ -78,10 +77,10 @@ To use the Python client, see `huggingface_hub`'s [package reference](https://hu ```js async function query(data) { const response = await fetch( - "https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq", + "https://api-inference.huggingface.co/models/", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/text-classification.md b/docs/api-inference/tasks/text-classification.md index 63cfcbd25..83cf43653 100644 --- a/docs/api-inference/tasks/text-classification.md +++ b/docs/api-inference/tasks/text-classification.md @@ -42,7 +42,7 @@ curl https://api-inference.huggingface.co/models/distilbert/distilbert-base-unca -X POST \ -d '{"inputs": "I like you. I love you"}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -72,7 +72,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/distilbert/distilbert-base-uncased-finetuned-sst-2-english", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/text-generation.md b/docs/api-inference/tasks/text-generation.md index f04909d4d..5ffd01050 100644 --- a/docs/api-inference/tasks/text-generation.md +++ b/docs/api-inference/tasks/text-generation.md @@ -44,7 +44,7 @@ curl https://api-inference.huggingface.co/models/google/gemma-2-2b-it \ -X POST \ -d '{"inputs": "Can you please let us know more details about your "}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -74,7 +74,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/google/gemma-2-2b-it", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/text-to-image.md b/docs/api-inference/tasks/text-to-image.md index 047851014..8e8a8ebf6 100644 --- a/docs/api-inference/tasks/text-to-image.md +++ b/docs/api-inference/tasks/text-to-image.md @@ -40,7 +40,7 @@ curl https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev \ -X POST \ -d '{"inputs": "Astronaut riding a horse"}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -84,7 +84,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/token-classification.md b/docs/api-inference/tasks/token-classification.md index 8826fe1f4..5925cce6c 100644 --- a/docs/api-inference/tasks/token-classification.md +++ b/docs/api-inference/tasks/token-classification.md @@ -42,7 +42,7 @@ curl https://api-inference.huggingface.co/models/dslim/bert-base-NER \ -X POST \ -d '{"inputs": "My name is Sarah Jessica Parker but you can call me Jessica"}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -72,7 +72,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/dslim/bert-base-NER", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/translation.md b/docs/api-inference/tasks/translation.md index 0a41bd31a..aa3910e5a 100644 --- a/docs/api-inference/tasks/translation.md +++ b/docs/api-inference/tasks/translation.md @@ -39,7 +39,7 @@ curl https://api-inference.huggingface.co/models/google-t5/t5-base \ -X POST \ -d '{"inputs": "Меня зовут Вольфганг и я живу в Берлине"}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -69,7 +69,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/google-t5/t5-base", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/docs/api-inference/tasks/zero-shot-classification.md b/docs/api-inference/tasks/zero-shot-classification.md index 5508e3912..5f9caa07a 100644 --- a/docs/api-inference/tasks/zero-shot-classification.md +++ b/docs/api-inference/tasks/zero-shot-classification.md @@ -40,7 +40,7 @@ curl https://api-inference.huggingface.co/models/facebook/bart-large-mnli \ -X POST \ -d '{"inputs": "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!", "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}' \ -H 'Content-Type: application/json' \ - -H "Authorization: Bearer hf_***" + -H 'Authorization: Bearer hf_***' ``` @@ -71,7 +71,7 @@ async function query(data) { "https://api-inference.huggingface.co/models/facebook/bart-large-mnli", { headers: { - Authorization: "Bearer hf_***" + Authorization: "Bearer hf_***", "Content-Type": "application/json", }, method: "POST", diff --git a/scripts/api-inference/package.json b/scripts/api-inference/package.json index 5070922e3..17251ec60 100644 --- a/scripts/api-inference/package.json +++ b/scripts/api-inference/package.json @@ -14,7 +14,7 @@ "author": "", "license": "ISC", "dependencies": { - "@huggingface/tasks": "^0.13.5", + "@huggingface/tasks": "^0.13.6", "@types/node": "^22.5.0", "handlebars": "^4.7.8", "node": "^20.17.0", diff --git a/scripts/api-inference/pnpm-lock.yaml b/scripts/api-inference/pnpm-lock.yaml index 0ab642fff..d4923584b 100644 --- a/scripts/api-inference/pnpm-lock.yaml +++ b/scripts/api-inference/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@huggingface/tasks': - specifier: ^0.13.5 - version: 0.13.5 + specifier: ^0.13.6 + version: 0.13.6 '@types/node': specifier: ^22.5.0 version: 22.5.0 @@ -186,8 +186,8 @@ packages: cpu: [x64] os: [win32] - '@huggingface/tasks@0.13.5': - resolution: {integrity: sha512-it34pRq4FP+fnKSLR+9Ksfe+t+O+L2vzMcfgRZQ0wsPM/hvSBxLWExdkiiNdz6RZnB1UY8RUZ8IvcvgVzxCceg==} + '@huggingface/tasks@0.13.6': + resolution: {integrity: sha512-5z7pkiLZTywSwXU6MPeKGC/RGXqTeF5J9iSWDQE+QPn0AXzYBAqDHLXSfjGMXpLhFg31VGl8OxGOjfn3dH+DWw==} '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} @@ -404,7 +404,7 @@ snapshots: '@esbuild/win32-x64@0.23.1': optional: true - '@huggingface/tasks@0.13.5': {} + '@huggingface/tasks@0.13.6': {} '@jridgewell/resolve-uri@3.1.2': {}