You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.audio_classification).
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#audioclassification).
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.automatic_speech-recognition).
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#automaticspeech-recognition).
"messages": [{"role": "user", "content": "What is the capital of France?"}],
70
-
"max_tokens": 500,
71
-
"stream": false
72
-
}'
73
-
64
+
[object Object]
74
65
```
75
66
</curl>
76
67
77
68
<python>
78
69
```py
79
-
from huggingface_hub import InferenceClient
80
-
81
-
client = InferenceClient(api_key="hf_***")
82
-
83
-
for message in client.chat_completion(
84
-
model="google/gemma-2-2b-it",
85
-
messages=[{"role": "user", "content": "What is the capital of France?"}],
86
-
max_tokens=500,
87
-
stream=True,
88
-
):
89
-
print(message.choices[0].delta.content, end="")
70
+
[object Object],[object Object]
90
71
```
91
72
92
73
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.chat_completion).
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#chatcompletion).
@@ -121,77 +92,21 @@ To use the JavaScript client, see `huggingface.js`'s [package reference](https:/
{"type":"text", "text":"Describe this image in one sentence."},
161
-
],
162
-
}
163
-
],
164
-
max_tokens=500,
165
-
stream=True,
166
-
):
167
-
print(message.choices[0].delta.content, end="")
101
+
[object Object],[object Object]
168
102
```
169
103
170
104
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.chat_completion).
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#chatcompletion).
"inputs": "Today is a sunny day and I will get some ice cream.",
64
-
})
49
+
[object Object]
65
50
```
66
51
67
52
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.feature_extraction).
query({"inputs":"Today is a sunny day and I will get some ice cream."}).then((response) => {
89
-
console.log(JSON.stringify(response));
90
-
});
57
+
[object Object]
91
58
```
92
59
93
60
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#featureextraction).
"inputs": "The answer to the universe is [MASK].",
60
-
})
45
+
[object Object]
61
46
```
62
47
63
48
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.fill_mask).
query({"inputs":"The answer to the universe is [MASK]."}).then((response) => {
85
-
console.log(JSON.stringify(response));
86
-
});
53
+
[object Object]
87
54
```
88
55
89
56
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#fillmask).
0 commit comments