mirror of
https://github.com/Paillat-dev/viralfactory.git
synced 2026-01-02 17:24:54 +00:00
feat(GenerationContext.py): add new file GenerationContext.py to handle the context of generation engines
feat(OpenaiLLMEngine.py): add orjson library for JSON serialization and deserialization, and implement the generate method to make API call to OpenAI chat completions endpoint feat(__init__.py): import OpenaiLLMEngine in LLMEngine package feat(BaseScriptEngine.py): add time_script method to the BaseScriptEngine class feat(CustomScriptEngine.py): add new file CustomScriptEngine.py to handle custom script generation, implement generate method to return the provided script, and add get_options method to provide a textbox for the prompt input feat(__init__.py): import CustomScriptEngine in ScriptEngine package feat(__init__.py): import LLMEngine package and add OpenaiLLMEngine to the ENGINES dictionary refactor(gradio_ui.py): change equal_height attribute of Row to False to allow different heights for input blocks
This commit is contained in:
25
src/engines/ScriptEngine/CustomScriptEngine.py
Normal file
25
src/engines/ScriptEngine/CustomScriptEngine.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from .BaseScriptEngine import BaseScriptEngine
|
||||
import gradio as gr
|
||||
|
||||
|
||||
class CustomScriptEngine(BaseScriptEngine):
|
||||
name = "Custom Script Engine"
|
||||
description = "Generate a script with a custom provided prompt"
|
||||
num_options = 1
|
||||
|
||||
def __init__(self, options: list[list | tuple | str | int | float | bool | None]):
|
||||
self.script = options[0]
|
||||
super().__init__()
|
||||
|
||||
def generate(self, *args, **kwargs) -> str:
|
||||
return self.script
|
||||
|
||||
@classmethod
|
||||
def get_options(cls) -> list:
|
||||
return [
|
||||
gr.Textbox(
|
||||
label="Prompt",
|
||||
placeholder="Enter your prompt here",
|
||||
value="",
|
||||
)
|
||||
]
|
||||
Reference in New Issue
Block a user