Download test_chatterbox.py from abidlabs/hfstudio: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/test_chatterbox.py
- Command line
-
hf download hf://spaces/abidlabs/hfstudio/test_chatterbox.py
-
curl -L -o test_chatterbox.py https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/test_chatterbox.py
549 Bytes
| #!/usr/bin/env python3 | |
| from huggingface_hub import InferenceClient | |
| # Initialize the client | |
| client = InferenceClient( | |
| provider="fal-ai", | |
| ) | |
| # Test parameters (matching what our app sends) | |
| text = "In a hole in the ground there lived a hobbit." | |
| extra_body = { | |
| "exaggeration": 0.25, | |
| "temperature": 0.7, | |
| "audio_url": "https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/frontend/static/voices/lily.mp3", | |
| } | |
| bytes = client.text_to_speech( | |
| text, | |
| model="ResembleAI/chatterbox", | |
| extra_body=extra_body, | |
| ) | |
| print(bytes) | |