Spaces:
Sleeping
Sleeping
Download scripts/hf_test.py from Evoblack/LibreTranslate-Marathi: direct link, hf CLI and curl.
- Browser
- Download file 321 Bytes
-
https://huggingface.co/spaces/Evoblack/LibreTranslate-Marathi/resolve/main/scripts/hf_test.py
- Command line
-
hf download hf://spaces/Evoblack/LibreTranslate-Marathi/scripts/hf_test.py
-
curl -L -o hf_test.py https://huggingface.co/spaces/Evoblack/LibreTranslate-Marathi/resolve/main/scripts/hf_test.py
321 Bytes
| from libretranslate.hf_adapter import get_translator | |
| print('Loading translator...') | |
| tr = get_translator('en','mr') | |
| print('Translator:', tr) | |
| if tr: | |
| hyps = tr.hypotheses('Hello world', 1) | |
| print('Hypotheses:', hyps) | |
| if hyps: | |
| print('Translated:', hyps[0].value) | |
| else: | |
| print('No translator available') | |