Feat : updat requirement & tts

This commit is contained in:
martin legrand
2025-02-23 10:36:17 +01:00
parent 561169b90a
commit 298c26a63f
5 changed files with 19 additions and 19 deletions
+7 -7
View File
@@ -4,14 +4,14 @@ import soundfile as sf
import subprocess
import re
# 🇺🇸 'a' => American English, 🇬🇧 'b' => British English
# 🇯🇵 'j' => Japanese: pip install misaki[ja]
# 🇨🇳 'z' => Mandarin Chinese: pip install misaki[zh]
pipeline = KPipeline(lang_code='a') # <= make sure lang_code matches voice
class Speech():
def __init__(self) -> None:
self.pipeline = KPipeline(lang_code='a')
def __init__(self, language = "english") -> None:
self.lang_map = {
"english": 'a', # 🇺🇸 'a' => American English
"chinese": 'z', # 🇯🇵 'j' => Japanese: pip install misaki[ja]
"japanese": 'j' # # 🇨🇳 'z' => Mandarin Chinese: pip install misaki[zh]
}
self.pipeline = KPipeline(lang_code=self.lang_map[language])
def speak(self, sentence):
sentence = self.clean_sentence(sentence)
+2 -2
View File
@@ -17,7 +17,7 @@ class BashInterpreter(Tools):
super().__init__()
self.tag = "bash"
def execute(self, commands: str, safety = False, timeout = 10):
def execute(self, commands: str, safety = False, timeout = 1000):
"""
Execute bash commands.
"""
@@ -35,7 +35,7 @@ class BashInterpreter(Tools):
return output.strip()
except subprocess.CalledProcessError as e:
return f"Command execution failed:\n{e.output}"
except subprocess.TimeoutExpired:
except subprocess.TimeoutExpired as e:
return f"Command timed out. Output:\n{e.output}"
def interpreter_feedback(self, output):