mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
added elevenlabs protection
This commit is contained in:
parent
af27856ce6
commit
8e4bb4182b
@ -144,8 +144,11 @@ class LollmsElevenLabsTTS(LollmsTTS):
|
||||
else:
|
||||
url = f"https://api.elevenlabs.io/v1/text-to-speech/{self.voice_id}"
|
||||
response = requests.post(url, json=payload, headers=headers)
|
||||
with open(speech_file_path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
if response.status_code == 200:
|
||||
with open(speech_file_path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
else:
|
||||
self.app.error(f"Couldn't generate speech, {response.reason}")
|
||||
|
||||
def play_audio(file_path):
|
||||
# Read the audio file
|
||||
|
Loading…
Reference in New Issue
Block a user