Translate text using the Hugging Face API. Enter English text and get the French translation.
HTML form for interacting with the function.
Query the model for a translation.
Parameters
| Name | Description | Location | Type | Sample Value |
|---|---|---|---|---|
| Content-Type | The content type of the request body | Header | application/json |
N/A |
| source | Text to translate | Body | String | My name is Walter |
Sample 200 Response:
Response from the model.
{
"ok": true,
"output": "Je m'appelle Walter"
}Sample 400 Response:
Response when the request source is missing.
{
"ok": false,
"error": "source is required."
}Sample 500 Response:
Response when the model fails to respond.
{
"ok": false,
"error": "Failed to query model."
}| Setting | Value |
|---|---|
| Runtime | Node (18.0) |
| Entrypoint | src/main.js |
| Build Commands | npm install |
| Permissions | any |
| Timeout (Seconds) | 15 |
An access token for the HuggingFace API. Get one by signing up at HuggingFace.
| Question | Answer |
|---|---|
| Required | Yes |
| Sample Value | api_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| Documentation | HuggingFace API Documentation |