diff --git a/screens.py b/screens.py index 8d1c905..79adebf 100644 --- a/screens.py +++ b/screens.py @@ -19,7 +19,6 @@ from textual.screen import Screen from textual.worker import Worker, get_current_worker import pathlib import threading -import edge_tts as tts from playsound import playsound import particles as pt from reactor import Reactor, Apparatus, Glimpse @@ -95,6 +94,7 @@ class PrecachingScreen(Screen): cache = cache_dir / f"{aux.get_md5(text)}.wav" if not cache.exists(): try: + import edge_tts as tts communicate = tts.Communicate(text, "zh-CN-XiaoxiaoNeural") communicate.save_sync(str(cache)) return True @@ -330,6 +330,7 @@ class MemScreen(Screen): cache_dir.mkdir(parents=True, exist_ok=True) cache = cache_dir / f"{aux.get_md5(self.reactor.current_atom[1].content.replace('/',''))}.wav" if not cache.exists(): + import edge_tts as tts communicate = tts.Communicate( self.reactor.current_atom[1].content.replace("/", ""), "zh-CN-XiaoxiaoNeural",