Add the ability to insert the story prompt into the art guide.

The art guide now optionally supports the sequence <|>
If this exists in the art guide, <|> is replaced by the story summary.
Otherwise, the art guide is appended to the summary as before.
Update the default art guide to place the medium before the summary.
Also update the art guide tooltip to include the new default.
This commit is contained in:
Llama
2023-01-01 21:12:25 -08:00
parent 26185b4b4e
commit 48dd451a8c
3 changed files with 15 additions and 7 deletions

View File

@@ -9492,7 +9492,7 @@ def UI_2_generate_image_from_story(data):
koboldai_vars.generating_image = True
eventlet.sleep(0)
art_guide = '{}'.format(koboldai_vars.img_gen_art_guide)
art_guide = str(koboldai_vars.img_gen_art_guide)
if 'action_id' in data and (int(data['action_id']) in koboldai_vars.actions.actions or int(data['action_id']) == -1):
action_id = int(data['action_id'])
@@ -9526,13 +9526,21 @@ def UI_2_generate_image_from_story(data):
max_length = args.max_summary_length - len(koboldai_vars.summary_tokenizer.encode(art_guide))
keys = [summarize(text, max_length=max_length)]
logger.debug("Text from summarizer: {}".format(keys[0]))
prompt = ", ".join(keys)
logger.debug("Text from summarizer: {}".format(prompt))
if art_guide:
if '<|>' in art_guide:
full_prompt = art_guide.replace('<|>', prompt)
else:
full_prompt = f"{prompt}, {art_guide}"
else:
full_prompt = prompt
generate_story_image(
", ".join([part for part in [prompt, art_guide] if part]),
full_prompt,
file_prefix=f"action_{action_id}",
display_prompt=prompt,
display_prompt=full_prompt,
log_data={"actionId": action_id},
)

View File

@@ -613,7 +613,7 @@ gensettingstf = [
"label": "Art Guide",
"id": "img_gen_art_guide",
"default": "",
"tooltip": "The art guide sent with image gen requests. \nDefault: fantasy illustration, artstation, by jason felix by steve argyle by tyler jacobson by peter mohrbacher, cinematic lighting",
"tooltip": "The art guide sent with image gen requests. <|> (optional) is replaced with the story summary, otherwise the art guide is appended to the summary. \nDefault: masterpiece, digital painting, <|>, dramatic lighting, highly detailed, trending",
"menu_path": "Interface",
"sub_path": "Images",
"classname": "user",

View File

@@ -1159,7 +1159,7 @@ class user_settings(settings):
self.show_budget = False
self.ui_level = 2
self.img_gen_api_url = "http://127.0.0.1:7860"
self.img_gen_art_guide = "digital painting, dramatic lighting, highly detailed, trending"
self.img_gen_art_guide = "masterpiece, digital painting, <|>, dramatic lighting, highly detailed, trending"
self.img_gen_negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name"
self.img_gen_steps = 30
self.img_gen_cfg_scale = 7.0