mirror of
https://github.com/Paillat-dev/viralfactory.git
synced 2026-01-02 09:16:19 +00:00
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:
14
src/utils/prompting.py
Normal file
14
src/utils/prompting.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import yaml
|
||||
import os
|
||||
from typing import TypedDict
|
||||
|
||||
class Prompt(TypedDict):
|
||||
system: str
|
||||
chat: str
|
||||
|
||||
def get_prompt(name, *, location = "src/chore/prompts") -> Prompt:
|
||||
path = os.path.join(os.getcwd(), location, f"{name}.yaml")
|
||||
if not os.path.exists(path):
|
||||
raise FileNotFoundError(f"Prompt file {path} does not exist.")
|
||||
with open(path, "r") as file:
|
||||
return yaml.safe_load(file)
|
||||
Reference in New Issue
Block a user