Spaces:
Runtime error
Runtime error
Download src/utils.py from aryadytm/paraphrase: direct link, hf CLI and curl.
- Browser
- Download file 532 Bytes
-
https://huggingface.co/spaces/aryadytm/paraphrase/resolve/main/src/utils.py
- Command line
-
hf download hf://spaces/aryadytm/paraphrase/src/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/aryadytm/paraphrase/resolve/main/src/utils.py
532 Bytes
| from easytextgen import EasyPrompt | |
| from translate import Translator | |
| trans_to_id = Translator(to_lang="id") | |
| trans_to_en = Translator(to_lang="en") | |
| prompt = EasyPrompt.from_file("assets/paraphrase-v1.yml") | |
| def paraphrase_english(english_text: str) -> str: | |
| return prompt.get_output(english_text).output_text.strip() | |
| def paraphrase_indonesian(indonesian_text: str) -> str: | |
| eng_text = trans_to_en.translate(indonesian_text) | |
| eng_paraphrased = paraphrase_english(eng_text) | |
| return trans_to_id.translate(eng_paraphrased) |