fix(GenerationContext.py): fix typo in variable name powerfulllmengine to powerfulllmengine for better readability

feat(GenerationContext.py): add setup_dir method to create a directory for output files with a timestamp
feat(GenerationContext.py): call setup_dir method before generating script and synthesizing audio to ensure output directory exists
feat(prompts/fix_captions.yaml): add a new prompt file to provide instructions for fixing captions
fix(BaseTTSEngine.py): add force_duration method to adjust audio clip duration if it exceeds a specified duration
feat(CoquiTTSEngine.py): add options for forcing duration and specifying duration in the UI
feat(utils/prompting.py): add get_prompt function to load prompt files from a specified location
fix(gradio_ui.py): set equal_height=True for engine_rows to ensure consistent height for engine options
This commit is contained in:
2024-02-15 12:27:13 +01:00
parent 9f88e6d069
commit 57bcf0af8e
7 changed files with 73 additions and 9 deletions

View File

@@ -1,17 +1,31 @@
import moviepy
import time
import os
from .. import engines
from ..utils.prompting import get_prompt
class GenerationContext:
def __init__(self, llmengine: engines.LLMEngine.BaseLLMEngine, scriptengine: engines.ScriptEngine.BaseScriptEngine, ttsengine: engines.TTSEngine.BaseTTSEngine) -> None:
self.llmengine = llmengine
self.llmengine.ctx = self
def __init__(self, powerfulllmengine: engines.LLMEngine.BaseLLMEngine, simplellmengine: engines.LLMEngine.BaseLLMEngine, scriptengine: engines.ScriptEngine.BaseScriptEngine, ttsengine: engines.TTSEngine.BaseTTSEngine) -> None:
self.powerfulllmengine = powerfulllmengine
self.powerfulllmengine.ctx = self
self.simplellmengine = simplellmengine
self.simplellmengine.ctx = self
self.scriptengine = scriptengine
self.scriptengine.ctx = self
self.ttsengine = ttsengine
self.ttsengine.ctx = self
def setup_dir(self):
self.dir = f"output/{time.time()}"
os.makedirs(self.dir)
def process(self):
timed_script = self.scriptengine.generate()
self.setup_dir()
script = self.scriptengine.generate()
timed_script = self.ttsengine.synthesize(script, self.dir)

View File

@@ -0,0 +1,8 @@
system: |-
You will recieve from the user a textual script and its captions. Since the captions have been generated trough stt, they might contain some errors. Your task is to fix theese transcription errors and return the corrected captions, keeping the timestamped format.
Please return valid json output, with no extra characters or comments, nor any codeblocks.
chat: |-
{script}
{captions}