Download app/utils/text.py from grimshaw/cpu-tts: direct link, hf CLI and curl.
- Browser
- Download file 356 Bytes
-
https://huggingface.co/spaces/grimshaw/cpu-tts/resolve/main/app/utils/text.py
- Command line
-
hf download hf://spaces/grimshaw/cpu-tts/app/utils/text.py
-
curl -L -o text.py https://huggingface.co/spaces/grimshaw/cpu-tts/resolve/main/app/utils/text.py
356 Bytes
| from app.errors import OpenAICompatibleError | |
| def ensure_max_length(text: str, max_length: int) -> None: | |
| if len(text) > max_length: | |
| raise OpenAICompatibleError( | |
| status_code=400, | |
| message=f"Input exceeds maximum length of {max_length} characters.", | |
| param="input", | |
| code="input_too_long", | |
| ) | |