Skip to content

Commit f6df83b

Browse files
Add api playground to chat completion template doc + run generate script (#1468)
1 parent 11be0d6 commit f6df83b

File tree

7 files changed

+25
-7
lines changed

7 files changed

+25
-7
lines changed

docs/api-inference/tasks/image-segmentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For more details about the `image-segmentation` task, check out its [dedicated p
2424

2525
### Recommended models
2626

27-
- [nvidia/segformer-b0-finetuned-ade-512-512](https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512): Semantic segmentation model trained on ADE20k benchmark dataset with 512x512 resolution.
27+
- [nvidia/segformer-b0-finetuned-ade-512-512](https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512): Semantic segmentation model trained on ADE20k dataset.
2828

2929
Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=image-segmentation&sort=trending).
3030

docs/api-inference/tasks/object-detection.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ For more details about the `object-detection` task, check out its [dedicated pag
2424

2525
### Recommended models
2626

27-
- [facebook/detr-resnet-50](https://huggingface.co/facebook/detr-resnet-50): Solid object detection model trained on the benchmark dataset COCO 2017.
28-
- [microsoft/beit-base-patch16-224-pt22k-ft22k](https://huggingface.co/microsoft/beit-base-patch16-224-pt22k-ft22k): Strong object detection model trained on ImageNet-21k dataset.
27+
- [facebook/detr-resnet-50](https://huggingface.co/facebook/detr-resnet-50): Solid object detection model pre-trained on the COCO 2017 dataset.
2928

3029
Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=object-detection&sort=trending).
3130

docs/api-inference/tasks/question-answering.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ For more details about the `question-answering` task, check out its [dedicated p
2626

2727
- [deepset/roberta-base-squad2](https://huggingface.co/deepset/roberta-base-squad2): A robust baseline model for most question answering domains.
2828
- [distilbert/distilbert-base-cased-distilled-squad](https://huggingface.co/distilbert/distilbert-base-cased-distilled-squad): Small yet robust model that can answer questions.
29+
- [google/tapas-base-finetuned-wtq](https://huggingface.co/google/tapas-base-finetuned-wtq): A special model that can answer questions from tables.
2930

3031
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).
3132

docs/api-inference/tasks/table-question-answering.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ For more details about the `table-question-answering` task, check out its [dedic
2424

2525
### Recommended models
2626

27+
- [google/tapas-base-finetuned-wtq](https://huggingface.co/google/tapas-base-finetuned-wtq): A robust table question answering model.
2728

2829
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).
2930

@@ -34,7 +35,7 @@ Explore all available models and find the one that suits you best [here](https:/
3435

3536
<curl>
3637
```bash
37-
curl https://api-inference.huggingface.co/models/<REPO_ID> \
38+
curl https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq \
3839
-X POST \
3940
-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" ] } }}' \
4041
-H 'Content-Type: application/json' \
@@ -46,7 +47,7 @@ curl https://api-inference.huggingface.co/models/<REPO_ID> \
4647
```py
4748
import requests
4849

49-
API_URL = "https://api-inference.huggingface.co/models/<REPO_ID>"
50+
API_URL = "https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq"
5051
headers = {"Authorization": "Bearer hf_***"}
5152

5253
def query(payload):
@@ -77,7 +78,7 @@ To use the Python client, see `huggingface_hub`'s [package reference](https://hu
7778
```js
7879
async function query(data) {
7980
const response = await fetch(
80-
"https://api-inference.huggingface.co/models/<REPO_ID>",
81+
"https://api-inference.huggingface.co/models/google/tapas-base-finetuned-wtq",
8182
{
8283
headers: {
8384
Authorization: "Bearer hf_***"

docs/api-inference/tasks/token-classification.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ If `stream` is `false` (default), the response will be a JSON object with the fo
131131
| Body | |
132132
| :--- | :--- | :--- |
133133
| **(array)** | _object[]_ | Output is an array of objects. |
134-
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entity_group** | _string_ | The predicted label for that group of tokens |
134+
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entity_group** | _string_ | The predicted label for a group of one or more tokens |
135+
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entity** | _string_ | The predicted label for a single token |
135136
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;score** | _number_ | The associated score / probability |
136137
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word** | _string_ | The corresponding text |
137138
| **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start** | _integer_ | The character position in the input where this group begins. |

docs/api-inference/tasks/zero-shot-classification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ For more details about the `zero-shot-classification` task, check out its [dedic
2525
### Recommended models
2626

2727
- [facebook/bart-large-mnli](https://huggingface.co/facebook/bart-large-mnli): Powerful zero-shot text classification model.
28+
- [MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7](https://huggingface.co/MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7): Powerful zero-shot multilingual text classification model that can accomplish multiple tasks.
2829

2930
Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=zero-shot-classification&sort=trending).
3031

scripts/api-inference/templates/task/chat-completion.handlebars

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ This is a subtask of [`text-generation`](https://huggingface.co/docs/api-inferen
1717
- [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
1818
{{/each}}
1919

20+
### API Playground
21+
22+
For Chat Completion models, we provide an interactive UI Playground for easier testing:
23+
24+
- Quickly iterate on your prompts from the UI.
25+
- Set and override system, assistant and user messages.
26+
- Browse and select models currently available on the Inference API.
27+
- Compare the output of two models side-by-side.
28+
- Adjust requests parameters from the UI.
29+
- Easily switch between UI view and code snippets.
30+
31+
<a href="https://huggingface.co/playground" target="blank"><img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/9_Tgf0Tv65srhBirZQMTp.png" style="max-width: 400px; width: 100%;"/></a>
32+
33+
Access the Inference UI Playground and start exploring: [https://huggingface.co/playground](https://huggingface.co/playground)
34+
2035
### Using the API
2136

2237
The API supports:

0 commit comments

Comments
 (0)