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