| #!/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) | |