Download data/tests/test_ttv.py from introvoyz045/elevenlabs-python: direct link, hf CLI and curl.
- Browser
- Download file 918 Bytes
-
https://huggingface.co/datasets/introvoyz045/elevenlabs-python/resolve/main/data/tests/test_ttv.py
- Command line
-
hf download hf://datasets/introvoyz045/elevenlabs-python/data/tests/test_ttv.py
-
curl -L -o test_ttv.py https://huggingface.co/datasets/introvoyz045/elevenlabs-python/resolve/main/data/tests/test_ttv.py
918 Bytes
| from elevenlabs.client import ElevenLabs | |
| def test_voice_preview_generation(): | |
| """Test generating voice previews from description.""" | |
| client = ElevenLabs() | |
| # Test parameters | |
| description = "A warm and friendly female voice with a slight British accent, speaking clearly and professionally" | |
| sample_text = "This is a test message that needs to be at least one hundred characters long to meet the API requirements. Here it is." | |
| previews = client.text_to_voice.create_previews(voice_description=description, text=sample_text) | |
| assert hasattr(previews, "previews"), "Response should have 'previews' attribute" | |
| assert len(previews.previews) > 0, "Should receive at least one preview" | |
| assert hasattr(previews.previews[0], "generated_voice_id"), "Preview should contain generated_voice_id" | |
| assert hasattr(previews.previews[0], "audio_base_64"), "Preview should contain audio_base_64" | |