|
2 | 2 |
|
3 | 3 | 🐸CLI lets you use our services programmatically. |
4 | 4 |
|
5 | | -## Installation |
| 5 | +## Documentation |
6 | 6 |
|
7 | | -```bash |
8 | | -$ pip install coqui |
9 | | -``` |
10 | | - |
11 | | -To update an existing installation to the latest version, use: |
12 | | - |
13 | | -```bash |
14 | | -$ pip install -U coqui |
15 | | -``` |
16 | | - |
17 | | -## Usage |
18 | | - |
19 | | -From CLI: |
20 | | - |
21 | | -``` |
22 | | -$ coqui --help |
23 | | -Usage: coqui [OPTIONS] COMMAND [ARGS]... |
24 | | -
|
25 | | -Options: |
26 | | - --base-url TEXT |
27 | | - --help Show this message and exit. |
28 | | -
|
29 | | -Commands: |
30 | | - login |
31 | | - tts |
32 | | -$ coqui login --token YOUR_API_TOKEN_HERE |
33 | | -Logged in! |
34 | | -$ coqui tts list-voices --help |
35 | | -coqui tts list-voices --help |
36 | | -Usage: coqui tts list-voices [OPTIONS] |
37 | | -
|
38 | | -Options: |
39 | | - --fields TEXT CSV output, specify which attributes of the available cloned |
40 | | - voices to print. Comma separated list, eg: -f id,name. |
41 | | - Available fields: id, name, samples_count, created_at |
42 | | - --json Print output as JSON |
43 | | - --help Show this message and exit. |
44 | | -$ coqui tts list-voices |
45 | | -[ClonedVoice(id='030527c9-1ae6-4e14-a4de-e063816d0fe4', name='once upon a time', samples_count=3, created_at=datetime.datetime(2022, 7, 13, 18, 38, 8, 725000)), ClonedVoice(id='04dd7d71-f474-45d1-8743-a7fcb4f8b3c4', name='once upon a time 2', samples_count=0, created_at=datetime.datetime(2022, 7, 15, 11, 55, 17, 155000))] |
46 | | -$ coqui tts clone-voice --help |
47 | | -Usage: coqui tts clone-voice [OPTIONS] |
48 | | -
|
49 | | -Options: |
50 | | - --audio_file TEXT Path of reference audio file to clone voice from |
51 | | - --name TEXT Name of cloned voice |
52 | | - --json Print output as JSON |
53 | | - --help Show this message and exit. |
54 | | -$ coqui tts clone-voice --audio_file ~/Downloads/blob_PSxUPIV.wav --name "once upon a time 3" |
55 | | -ClonedVoice(id='4b7a1b08-67f9-4bf2-8600-f97cd39bd39c', name='once upon a time 3', samples_count=0, created_at=datetime.datetime(2022, 7, 15, 12, 37, 3, 111000)) |
56 | | -$ coqui tts synthesize --help |
57 | | -Usage: coqui tts synthesize [OPTIONS] |
58 | | -
|
59 | | -Options: |
60 | | - --voice UUID ID of voice to synthesize |
61 | | - --text TEXT Text to synthesize |
62 | | - --speed FLOAT Speed parameter for synthesis |
63 | | - --name TEXT Name of sample |
64 | | - --save TEXT If specified, save the synthesized sample to this file name. |
65 | | - --play If specified, play the synthesized sample |
66 | | - --json Print output as JSON |
67 | | - --help Show this message and exit. |
68 | | -$ coqui tts synthesize --voice 4b7a1b08-67f9-4bf2-8600-f97cd39bd39c --text "hello from the world of synthesis" --save foo.wav |
69 | | -Saved synthesized sample to foo.wav |
70 | | -$ play foo.wav |
71 | | -
|
72 | | -foo.wav: |
73 | | -
|
74 | | - File Size: 175k Bit Rate: 706k |
75 | | - Encoding: Signed PCM |
76 | | - Channels: 1 @ 16-bit |
77 | | -Samplerate: 44100Hz |
78 | | -Replaygain: off |
79 | | - Duration: 00:00:01.99 |
80 | | -
|
81 | | -In:100% 00:00:01.99 [00:00:00.00] Out:95.3k [ | ] Hd:0.0 Clip:0 |
82 | | -Done. |
83 | | -$ coqui tts list-samples --voice 4b7a1b08-67f9-4bf2-8600-f97cd39bd39c |
84 | | -[Sample(id='33115d0a-e555-4fb0-9a66-98edf56143a9', name='hello from the world of synthe', text='hello from the world of synthesis', created_at=datetime.datetime(2022, 7, 15, 12, 40, 19, 981000), audio_url='https://coqui-dev-creator-app-synthesized-samples.s3.amazonaws.com/samples/sample_wqmGJri.wav?AWSAccessKeyId=AKIAXW7NFYT5F2KY3J4D&Signature=wU3Px%2FgnuK7TMghRRFRRPKfUuXs%3D&Expires=1657892449')] |
85 | | -``` |
86 | | - |
87 | | -Programmatically: |
88 | | - |
89 | | -```python |
90 | | -from coqui import Coqui |
91 | | -API_TOKEN = "your token goes here" |
92 | | -coqui = Coqui() |
93 | | -coqui.login(API_TOKEN) |
94 | | -print("\n".join(f"{v.id - v.name}" for v in coqui.cloned_voices())) |
95 | | -``` |
96 | | - |
97 | | -Async APIs: |
98 | | - |
99 | | -```python |
100 | | -$ python -m asyncio |
101 | | -asyncio REPL 3.10.2 (main, Feb 8 2022, 18:36:32) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin |
102 | | -Use "await" directly instead of "asyncio.run()". |
103 | | -Type "help", "copyright", "credits" or "license" for more information. |
104 | | ->>> import asyncio |
105 | | ->>> from coqui import Coqui |
106 | | ->>> await coqui.cloned_voices_async() |
107 | | -Traceback (most recent call last): |
108 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/concurrent/futures/_base.py", line 446, in result |
109 | | - return self.__get_result() |
110 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result |
111 | | - raise self._exception |
112 | | - File "<console>", line 1, in <module> |
113 | | - File "/Users/reuben/Development/coqui-py/coqui/__init__.py", line 225, in cloned_voices |
114 | | - async with self._get_session() as session: |
115 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/contextlib.py", line 199, in __aenter__ |
116 | | - return await anext(self.gen) |
117 | | - File "/Users/reuben/Development/coqui-py/coqui/__init__.py", line 164, in _get_session |
118 | | - raise AuthenticationError( |
119 | | -coqui.AuthenticationError: Tried to create authenticated session without logging in. |
120 | | ->>> # Oops, forgot to login! |
121 | | ->>> API_TOKEN = "your token goes here" |
122 | | ->>> await coqui.login_async(API_TOKEN) |
123 | | -True |
124 | | ->>> await coqui.cloned_voices_async() |
125 | | -[ClonedVoice(id='030527c9-1ae6-4e14-a4de-e063816d0fe4', name='once upon a time', samples_count=3, created_at=datetime.datetime(2022, 7, 13, 18, 38, 8, 725000)), ClonedVoice(id='04dd7d71-f474-45d1-8743-a7fcb4f8b3c4', name='once upon a time 2', samples_count=0, created_at=datetime.datetime(2022, 7, 15, 11, 55, 17, 155000)), ClonedVoice(id='4b7a1b08-67f9-4bf2-8600-f97cd39bd39c', name='once upon a time 3', samples_count=5, created_at=datetime.datetime(2022, 7, 15, 12, 37, 3, 111000))] |
126 | | ->>> coqui.cloned_voices() |
127 | | -Traceback (most recent call last): |
128 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/concurrent/futures/_base.py", line 446, in result |
129 | | - return self.__get_result() |
130 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result |
131 | | - raise self._exception |
132 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/asyncio/__main__.py", line 34, in callback |
133 | | - coro = func() |
134 | | - File "<console>", line 1, in <module> |
135 | | - File "/Users/reuben/Development/coqui-py/coqui/__init__.py", line 44, in sync_func |
136 | | - return asyncio.run(meth(*args, **kwargs)) |
137 | | - File "/Users/reuben/.pyenv/versions/3.10.2/lib/python3.10/asyncio/runners.py", line 33, in run |
138 | | - raise RuntimeError( |
139 | | -RuntimeError: asyncio.run() cannot be called from a running event loop |
140 | | ->>> # Don't call sync methods in async contexts! |
141 | | -``` |
| 7 | +Usage documentation available at [coqui-py.readthedocs.io](https://coqui-py.readthedocs.io/). |
142 | 8 |
|
143 | 9 | ## Development |
144 | 10 |
|
|
0 commit comments