added new upgrades

This commit is contained in:
Saifeddine ALOUI 2024-08-19 14:51:05 +02:00
parent 2501ed87b4
commit 7e414334d9
2 changed files with 17 additions and 5 deletions

View File

@ -61,7 +61,7 @@ def build_image(prompt, negative_prompt, width, height, processor:APScript, clie
processor.personality.app.dalle = processor.personality.app.tti
processor.step_end("Loading dalle service")
processor.step_start("Painting")
file = processor.personality.app.tti.paint(
file, infos = processor.personality.app.tti.paint(
prompt,
negative_prompt,
width = width,
@ -80,7 +80,7 @@ def build_image(prompt, negative_prompt, width, height, processor:APScript, clie
processor.personality.app.dalle = processor.personality.app.tti
processor.step_end("Loading comfyui service")
processor.step_start("Painting")
file = processor.personality.app.tti.paint(
file, infos = processor.personality.app.tti.paint(
prompt,
negative_prompt,
width = width,
@ -121,10 +121,11 @@ def build_image_from_simple_prompt(prompt, processor:APScript, client:Client, wi
prompt = processor.build_prompt([
processor.system_full_header,
f"Act as artbot, the art prompt generation AI.",
"Use the discussion information to come up with an image generation prompt without referring to it.",
"Use the user prompt to come up with an image generation prompt without referring to it.",
f"Be precise and describe the style as well as the {production_type} description details.", #conditionning
"Do not explain the prompt, just answer with the prompt in the right prompting style.",
processor.system_custom_header("discussion"),
processor.system_custom_header("user prompt"),
prompt,
processor.system_custom_header("Production type") + f"{production_type}",
processor.system_custom_header("Instruction") + f"Use the following as examples and follow their format to build the special prompt." if examples!="" else "",
processor.system_custom_header("Prompt examples") if examples!="" else "",

View File

@ -249,6 +249,17 @@ def get_media_type(file_path):
return media_type
def app_path_to_url(file_path:str|Path)->str:
"""
This function takes a file path as an argument and converts it into a URL format. It first removes the initial part of the file path until the "outputs" string is reached, then replaces backslashes with forward slashes and quotes each segment with urllib.parse.quote() before joining them with forward slashes to form the final URL.
:param file_path: str, the file path in the format of a Windows system
:return: str, the converted URL format of the given file path
"""
file_path = str(file_path)
url = "/"+file_path[file_path.index("apps_zoo"):].replace("\\","/").replace("apps_zoo","apps")
return "/".join([urllib.parse.quote(p, safe="") for p in url.split("/")])
def discussion_path_to_url(file_path:str|Path)->str:
"""
This function takes a file path as an argument and converts it into a URL format. It first removes the initial part of the file path until the "outputs" string is reached, then replaces backslashes with forward slashes and quotes each segment with urllib.parse.quote() before joining them with forward slashes to form the final URL.