Add get_file_path method to GenerationContext class

This commit is contained in:
2024-02-15 18:03:09 +01:00
parent 4d8556c80a
commit a42987d864

View File

@@ -25,6 +25,9 @@ class GenerationContext:
def setup_dir(self): def setup_dir(self):
self.dir = f"output/{time.time()}" self.dir = f"output/{time.time()}"
os.makedirs(self.dir) os.makedirs(self.dir)
def get_file_path(self, name: str) -> str:
return os.path.join(self.dir, name)
def process(self): def process(self):
# IMPORTANT NOTE: All methods called here are expected to be defined as abstract methods in the base classes, if not there is an issue with the engine implementation. # IMPORTANT NOTE: All methods called here are expected to be defined as abstract methods in the base classes, if not there is an issue with the engine implementation.
@@ -32,4 +35,4 @@ class GenerationContext:
script = self.scriptengine.generate() script = self.scriptengine.generate()
timed_script = self.ttsengine.synthesize(script, self.dir) timed_script = self.ttsengine.synthesize(script, self.get_file_path("tts.wav"))