Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voices: add unfreeze_voice method #28

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/lmnt/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def voice_info(self, voice_id: str):
Returns details of a specific voice.

Required parameters:
- `voice_id`: The id of the voice to update. If you don't know the id, you can get it from `list_voices()`.
- `voice_id`: The id of the voice to get info on. If you don't know the id, you can get it from `list_voices()`.

Returns a dictionary containing details of the voice.
"""
Expand Down Expand Up @@ -249,6 +249,27 @@ async def update_voice(self, voice_id: str, **kwargs):
await self._handle_response_errors(resp, 'Speech.update_voice')
return await resp.json()

async def unfreeze_voice(self, voice_id: str):
"""
Unfreezes a professional voice clone owned by you.

We are constantly improving and releasing our speech models. Voices that are not being used will not be
upgraded automatically and will enter a frozen state.

Do not worry though. If your voice is frozen, call this method to upgrade it to the latest model.

Instant voices always use the latest model and are never frozen.
"""
self._lazy_init()
url = f'{self._base_url}{_VOICE_ENDPOINT}'.format(id=voice_id)
data = {
'unfreeze': True
}
data = json.dumps({k: v for k, v in data.items() if v is not None})
async with self._session.put(url, data=data, headers=self._build_headers(type='application/json')) as resp:
await self._handle_response_errors(resp, 'Speech.unfreeze_voice')
return await resp.json()

async def delete_voice(self, voice_id: str):
"""
Deletes a voice and cancels any pending operations on it. The voice must be owned by you. Cannot be undone.
Expand Down