mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-20 07:24:21 +01:00
Fixed formatting issues
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import gtts
|
||||
import os
|
||||
from playsound import playsound
|
||||
import requests
|
||||
from config import Config
|
||||
cfg = Config()
|
||||
import gtts
|
||||
|
||||
|
||||
# TODO: Nicer names for these ids
|
||||
@@ -14,7 +14,6 @@ tts_headers = {
|
||||
"xi-api-key": cfg.elevenlabs_api_key
|
||||
}
|
||||
|
||||
|
||||
def eleven_labs_speech(text, voice_index=0):
|
||||
"""Speak text using elevenlabs.io's API"""
|
||||
tts_url = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}".format(
|
||||
@@ -34,7 +33,6 @@ def eleven_labs_speech(text, voice_index=0):
|
||||
print("Response content:", response.content)
|
||||
return False
|
||||
|
||||
|
||||
def brian_speech(text):
|
||||
"""Speak text using Brian with the streamelements API"""
|
||||
tts_url = f"https://api.streamelements.com/kappa/v2/speech?voice=Brian&text={text}"
|
||||
@@ -51,18 +49,15 @@ def brian_speech(text):
|
||||
print("Response content:", response.content)
|
||||
return False
|
||||
|
||||
|
||||
def gtts_speech(text):
|
||||
tts = gtts.gTTS(text)
|
||||
tts.save("speech.mp3")
|
||||
playsound("speech.mp3")
|
||||
os.remove("speech.mp3")
|
||||
|
||||
|
||||
def macos_tts_speech(text):
|
||||
os.system(f'say "{text}"')
|
||||
|
||||
|
||||
def say_text(text, voice_index=0):
|
||||
if not cfg.elevenlabs_api_key:
|
||||
if cfg.use_mac_os_tts == 'True':
|
||||
@@ -76,4 +71,4 @@ def say_text(text, voice_index=0):
|
||||
else:
|
||||
success = eleven_labs_speech(text, voice_index)
|
||||
if not success:
|
||||
gtts_speech(text)
|
||||
gtts_speech(text)
|
||||
Reference in New Issue
Block a user