mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-24 06:46:40 +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)
|
||||||
|
if response.status_code == 200:
|
||||||
with open(speech_file_path, 'wb') as f:
|
with open(speech_file_path, 'wb') as f:
|
||||||
f.write(response.content)
|
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