Download data/tests/test_stt.py from introvoyz045/elevenlabs-python: direct link, hf CLI and curl.
- Browser
- Download file 675 Bytes
-
https://huggingface.co/datasets/introvoyz045/elevenlabs-python/resolve/main/data/tests/test_stt.py
- Command line
-
hf download hf://datasets/introvoyz045/elevenlabs-python/data/tests/test_stt.py
-
curl -L -o test_stt.py https://huggingface.co/datasets/introvoyz045/elevenlabs-python/resolve/main/data/tests/test_stt.py
675 Bytes
| import pytest | |
| from elevenlabs.client import AsyncElevenLabs, ElevenLabs | |
| from .utils import DEFAULT_VOICE_FILE | |
| DEFAULT_EXT_AUDIO = "https://storage.googleapis.com/eleven-public-cdn/audio/marketing/nicole.mp3" | |
| async def test_stt_convert(): | |
| """Test basic speech-to-text conversion.""" | |
| client = ElevenLabs() | |
| audio_file = open(DEFAULT_VOICE_FILE, "rb") | |
| transcription = client.speech_to_text.convert( | |
| file=audio_file, | |
| model_id="scribe_v2" | |
| ) | |
| assert isinstance(transcription.text, str) | |
| assert len(transcription.text) > 0 | |
| assert isinstance(transcription.words, list) | |
| assert len(transcription.words) > 0 | |