diff options
Diffstat (limited to 'autogpt/speech/stream_elements_speech.py')
-rw-r--r-- | autogpt/speech/stream_elements_speech.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/autogpt/speech/stream_elements_speech.py b/autogpt/speech/stream_elements_speech.py deleted file mode 100644 index e4e4e8bfe..000000000 --- a/autogpt/speech/stream_elements_speech.py +++ /dev/null @@ -1,44 +0,0 @@ -import logging -import os - -import requests -from playsound import playsound - -from autogpt.config import Config -from autogpt.speech.base import VoiceBase - - -class StreamElementsSpeech(VoiceBase): - """Streamelements speech module for autogpt""" - - def _setup(self, config: Config) -> None: - """Setup the voices, API key, etc.""" - - def _speech(self, text: str, voice: str, _: int = 0) -> bool: - """Speak text using the streamelements API - - Args: - text (str): The text to speak - voice (str): The voice to use - - Returns: - bool: True if the request was successful, False otherwise - """ - tts_url = ( - f"https://api.streamelements.com/kappa/v2/speech?voice={voice}&text={text}" - ) - response = requests.get(tts_url) - - if response.status_code == 200: - with open("speech.mp3", "wb") as f: - f.write(response.content) - playsound("speech.mp3") - os.remove("speech.mp3") - return True - else: - logging.error( - "Request failed with status code: %s, response content: %s", - response.status_code, - response.content, - ) - return False |