Skip to content

Commit

Permalink
Merge pull request #43 from huggingface/new-widget
Browse files Browse the repository at this point in the history
New widget
  • Loading branch information
philschmid authored Aug 21, 2023
2 parents d81db42 + 7cdd9be commit 1bb86ca
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions docs/source/guides/test_endpoint.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Send Requests to Endpoints

You can send requests to Inference Endpoints using the UI leveraging the Inference Widget or programmatically, e.g. with cURL or the `@huggingface/inference` library. Below you can find examples for each of these methods.
You can send requests to Inference Endpoints using the UI leveraging the Inference Widget or programmatically, e.g. with cURL, `@huggingface/inference`, `huggingface_hub` or any REST client. The Endpoint overview not only provides a interactive widget for you to test the Endpoint, but also generates code for `python`, `javascript` and `curl`. You can use this code to quickly get started with your Endpoint in your favorite programming language.

Below are also examples on how to use the `@huggingface/inference` library to call an inference endpoint.

## Use the UI to send requests

Expand All @@ -10,11 +12,6 @@ The Endpoint overview provides access to the Inference Widget which can be used

The cURL command for the request above should look like this. You'll need to provide your user token which can be found in your Hugging Face [account settings](https://huggingface.co/settings/tokens):

<img
src="https://raw.githubusercontent.com/huggingface/hf-endpoints-documentation/main/assets/2_copy_curl.png"
alt="copy curl"
/>

Example Request:

```bash
Expand Down Expand Up @@ -52,7 +49,7 @@ const { generated_text } = await gpt2.textGeneration({ inputs: 'The answer to th

### Custom handler

`@huggingface/inference` supports tasks from https://huggingface.co/tasks, and is typed accordingly.
`@huggingface/inference` supports tasks from https://huggingface.co/tasks, and is typed accordingly.

If your model has additional inputs, or even custom inputs / outputs you can use the more generic `.request` / `streamingRequest`:

Expand Down

0 comments on commit 1bb86ca

Please sign in to comment.