forked from elevenlabs/elevenlabs-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix): async tts is no longer awaited (elevenlabs#248)
- Loading branch information
1 parent
7ed8ef4
commit 92911c6
Showing
5 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import asyncio | ||
import pytest | ||
|
||
from .utils import IN_GITHUB, async_client | ||
from elevenlabs import play | ||
|
||
def test_async_generation(): | ||
async def main(): | ||
results = await async_client.generate( | ||
voice='Rachel', | ||
model='eleven_multilingual_v2', | ||
text='This is an example sentence', | ||
) | ||
out = b'' | ||
async for value in results: | ||
out += value | ||
if not IN_GITHUB: | ||
play(out) | ||
|
||
results = await async_client.generate( | ||
voice='Rachel', | ||
model='eleven_multilingual_v2', | ||
text='This is an example sentence with streaming', | ||
stream=True | ||
) | ||
out = b'' | ||
async for value in results: | ||
out += value | ||
if not IN_GITHUB: | ||
play(out) | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters