diff --git a/docs/api-inference/tasks/automatic-speech-recognition.md b/docs/api-inference/tasks/automatic-speech-recognition.md index b4a0bd865..c671d7f88 100644 --- a/docs/api-inference/tasks/automatic-speech-recognition.md +++ b/docs/api-inference/tasks/automatic-speech-recognition.md @@ -30,7 +30,6 @@ For more details about the `automatic-speech-recognition` task, check out its [d ### Recommended models - [openai/whisper-large-v3](https://huggingface.co/openai/whisper-large-v3): A powerful ASR model by OpenAI. -- [nvidia/canary-1b](https://huggingface.co/nvidia/canary-1b): A powerful multilingual ASR and Speech Translation model by Nvidia. - [pyannote/speaker-diarization-3.1](https://huggingface.co/pyannote/speaker-diarization-3.1): Powerful speaker diarization model. Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=automatic-speech-recognition&sort=trending). diff --git a/docs/api-inference/tasks/image-classification.md b/docs/api-inference/tasks/image-classification.md index 748088cd5..262876a48 100644 --- a/docs/api-inference/tasks/image-classification.md +++ b/docs/api-inference/tasks/image-classification.md @@ -25,6 +25,7 @@ For more details about the `image-classification` task, check out its [dedicated ### Recommended models - [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224): A strong image classification model. +- [facebook/deit-base-distilled-patch16-224](https://huggingface.co/facebook/deit-base-distilled-patch16-224): A robust image classification model. Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=image-classification&sort=trending). diff --git a/docs/api-inference/tasks/text-classification.md b/docs/api-inference/tasks/text-classification.md index f90a9d5e8..83cf43653 100644 --- a/docs/api-inference/tasks/text-classification.md +++ b/docs/api-inference/tasks/text-classification.md @@ -37,67 +37,54 @@ Explore all available models and find the one that suits you best [here](https:/ - ```bash -curl https://api-inference.huggingface.co/models/mixedbread-ai/mxbai-rerank-base-v1 \ - -X POST \ - -d '{"inputs": [{"text": "What is Paris?", "text_pair": "Paris is the capital of France"}]}' \ - -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer hf_***' +curl https://api-inference.huggingface.co/models/distilbert/distilbert-base-uncased-finetuned-sst-2-english \ + -X POST \ + -d '{"inputs": "I like you. I love you"}' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer hf_***' ``` - - -```python +```py import requests -API_URL = "https://api-inference.huggingface.co/models/mixedbread-ai/mxbai-rerank-base-v1" +API_URL = "https://api-inference.huggingface.co/models/distilbert/distilbert-base-uncased-finetuned-sst-2-english" headers = {"Authorization": "Bearer hf_***"} def query(payload): - response = requests.post(API_URL, headers=headers, json=payload) - return response.json() - + response = requests.post(API_URL, headers=headers, json=payload) + return response.json() + output = query({ - "inputs": [ - {"text": "What is Paris?", "text_pair": "Paris is the capital of France"}, - {"text": "What is Paris?", "text_pair": "London is the capital of England"} - ] + "inputs": "I like you. I love you", }) ``` To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.text_classification). - - -```javascript +```js async function query(data) { - const response = await fetch( - "https://api-inference.huggingface.co/models/mixedbread-ai/mxbai-rerank-base-v1", - { - headers: { - Authorization: "Bearer hf_***", - "Content-Type": "application/json", - }, - method: "POST", - body: JSON.stringify(data), - } - ); - const result = await response.json(); - return result; + const response = await fetch( + "https://api-inference.huggingface.co/models/distilbert/distilbert-base-uncased-finetuned-sst-2-english", + { + headers: { + Authorization: "Bearer hf_***", + "Content-Type": "application/json", + }, + method: "POST", + body: JSON.stringify(data), + } + ); + const result = await response.json(); + return result; } -query({ - "inputs": [ - {"text": "What is Paris?", "text_pair": "Paris is the capital of France"}, - {"text": "What is Paris?", "text_pair": "London is the capital of England"} - ] -}).then((response) => { - console.log(JSON.stringify(response)); +query({"inputs": "I like you. I love you"}).then((response) => { + console.log(JSON.stringify(response)); }); ``` @@ -107,6 +94,7 @@ To use the JavaScript client, see `huggingface.js`'s [package reference](https:/ + ### API specification #### Request diff --git a/scripts/api-inference/package.json b/scripts/api-inference/package.json index 22d2d7d6c..60382a5ac 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.11", + "@huggingface/tasks": "^0.13.14", "@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 df282c58f..ed9f9d9ca 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.11 - version: 0.13.11 + specifier: ^0.13.14 + version: 0.13.14 '@types/node': specifier: ^22.5.0 version: 22.5.0 @@ -186,8 +186,8 @@ packages: cpu: [x64] os: [win32] - '@huggingface/tasks@0.13.11': - resolution: {integrity: sha512-3fAiLfrUTz2RSt8mTmumxAC9+6fQIPYUXGM6/72cW6xVLIFYBrJElsHDaoHUr/I/KouMEzwJ6MBaTS7mRduBjA==} + '@huggingface/tasks@0.13.14': + resolution: {integrity: sha512-KQNU87o+wdXuuv+vl2T4CnBTDynEwI71Mjgao+HiswKyi9oAd8z+LnVzn9fmnzeONXpEf1u0o5iSDwEcGLCFtA==} '@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.11': {} + '@huggingface/tasks@0.13.14': {} '@jridgewell/resolve-uri@3.1.2': {}