Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Merge branch 'master' into master

Dylan N89853cf3b858
diff --cc scripts/speak.py
index 0f8c243d50,13517d366f..d8dd191bc3
--- a/scripts/speak.py
+++ b/scripts/speak.py
@@@ -40,22 -34,15 +40,23 @@@ def eleven_labs_speech(text, voice_inde
def gtts_speech(text):
tts = gtts.gTTS(text)
- tts.save("speech.mp3")
- playsound("speech.mp3")
- os.remove("speech.mp3")
+ with mutex_lock:
+ tts.save("speech.mp3")
+ playsound("speech.mp3", True)
+ os.remove("speech.mp3")
def say_text(text, voice_index=0):
- if not cfg.elevenlabs_api_key:
- gtts_speech(text)
- else:
- success = eleven_labs_speech(text, voice_index)
- if not success:
- gtts_speech(text)
+
+ def speak():
+ if not cfg.elevenlabs_api_key:
+ gtts_speech(text)
+ else:
+ success = eleven_labs_speech(text, voice_index)
+ if not success:
+ gtts_speech(text)
+
+ queue_semaphore.release()
+
+ queue_semaphore.acquire(True)
+ thread = threading.Thread(target=speak)
+ thread.start()