A baseline clone of
facebook/nllb-200-distilled-600M, packaged for
Hugging Face Inference Endpoints with a custom handler so callers can pass arbitrary NLLB Flores-200 language codes at request time.
1{
2 "inputs": "Hello, world!",
3 "parameters": {
4 "src_lang": "eng_Latn",
5 "tgt_lang": "spa_Latn",
6 "max_length": 256,
7 "num_beams": 4
8 }
9}
inputs may be a single string or a list of strings.
src_lang /
tgt_lang use the
Flores-200 codes (e.g.
eng_Latn,
spa_Latn,
fra_Latn,
zho_Hans,
arb_Arab). If omitted, the handler defaults to
eng_Latn →
spa_Latn.
1curl https://<your-endpoint>.endpoints.huggingface.cloud \
2 -H "Authorization: Bearer $HF_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "inputs": "Hello, world!",
6 "parameters": { "src_lang": "eng_Latn", "tgt_lang": "fra_Latn" }
7 }'
1import requests
2
3resp = requests.post(
4 "https://<your-endpoint>.endpoints.huggingface.cloud",
5 headers={"Authorization": f"Bearer {HF_TOKEN}"},
6 json={
7 "inputs": ["Hello, world!", "How are you?"],
8 "parameters": {"src_lang": "eng_Latn", "tgt_lang": "deu_Latn"},
9 },
10 timeout=30,
11)
12print(resp.json())