Commit fe7a623e authored by AUTOMATIC's avatar AUTOMATIC
Browse files

add a slider for default value of added extra networks

parent 78f59a4e
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
import json
import os
import os
import lora
import lora


@@ -26,7 +27,7 @@ class ExtraNetworksPageLora(ui_extra_networks.ExtraNetworksPage):
                "name": name,
                "name": name,
                "filename": path,
                "filename": path,
                "preview": preview,
                "preview": preview,
                "prompt": f"<lora:{name}:1.0>",
                "prompt": json.dumps(f"<lora:{name}:") + " + opts.extra_networks_default_multiplier + " + json.dumps(">"),
                "local_preview": path + ".png",
                "local_preview": path + ".png",
            }
            }


+2 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,8 @@ titles = {
    "Hires steps": "Number of sampling steps for upscaled picture. If 0, uses same as for original.",
    "Hires steps": "Number of sampling steps for upscaled picture. If 0, uses same as for original.",
    "Upscale by": "Adjusts the size of the image by multiplying the original width and height by the selected value. Ignored if either Resize width to or Resize height to are non-zero.",
    "Upscale by": "Adjusts the size of the image by multiplying the original width and height by the selected value. Ignored if either Resize width to or Resize height to are non-zero.",
    "Resize width to": "Resizes image to this width. If 0, width is inferred from either of two nearby sliders.",
    "Resize width to": "Resizes image to this width. If 0, width is inferred from either of two nearby sliders.",
    "Resize height to": "Resizes image to this height. If 0, height is inferred from either of two nearby sliders."
    "Resize height to": "Resizes image to this height. If 0, height is inferred from either of two nearby sliders.",
    "Multiplier for extra networks": "When adding extra network such as Hypernetwork or Lora to prompt, use this multiplier for it."
}
}




+3 −2
Original line number Original line Diff line number Diff line
@@ -406,7 +406,8 @@ options_templates.update(options_section(('sd', "Stable Diffusion"), {
    "enable_emphasis": OptionInfo(True, "Emphasis: use (text) to make model pay more attention to text and [text] to make it pay less attention"),
    "enable_emphasis": OptionInfo(True, "Emphasis: use (text) to make model pay more attention to text and [text] to make it pay less attention"),
    "enable_batch_seeds": OptionInfo(True, "Make K-diffusion samplers produce same images in a batch as when making a single image"),
    "enable_batch_seeds": OptionInfo(True, "Make K-diffusion samplers produce same images in a batch as when making a single image"),
    "comma_padding_backtrack": OptionInfo(20, "Increase coherency by padding from the last comma within n tokens when using more than 75 tokens", gr.Slider, {"minimum": 0, "maximum": 74, "step": 1 }),
    "comma_padding_backtrack": OptionInfo(20, "Increase coherency by padding from the last comma within n tokens when using more than 75 tokens", gr.Slider, {"minimum": 0, "maximum": 74, "step": 1 }),
    'CLIP_stop_at_last_layers': OptionInfo(1, "Clip skip", gr.Slider, {"minimum": 1, "maximum": 12, "step": 1}),
    "CLIP_stop_at_last_layers": OptionInfo(1, "Clip skip", gr.Slider, {"minimum": 1, "maximum": 12, "step": 1}),
    "extra_networks_default_multiplier": OptionInfo(1.0, "Multiplier for extra networks", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
}))
}))


options_templates.update(options_section(('compatibility', "Compatibility"), {
options_templates.update(options_section(('compatibility', "Compatibility"), {
+1 −1
Original line number Original line Diff line number Diff line
@@ -54,7 +54,7 @@ class ExtraNetworksPage:


        args = {
        args = {
            "preview_html": "style='background-image: url(" + json.dumps(preview) + ")'" if preview else '',
            "preview_html": "style='background-image: url(" + json.dumps(preview) + ")'" if preview else '',
            "prompt": json.dumps(item["prompt"]),
            "prompt": item["prompt"],
            "tabname": json.dumps(tabname),
            "tabname": json.dumps(tabname),
            "local_preview": json.dumps(item["local_preview"]),
            "local_preview": json.dumps(item["local_preview"]),
            "name": item["name"],
            "name": item["name"],
+2 −1
Original line number Original line Diff line number Diff line
import json
import os
import os


from modules import shared, ui_extra_networks
from modules import shared, ui_extra_networks
@@ -25,7 +26,7 @@ class ExtraNetworksPageHypernetworks(ui_extra_networks.ExtraNetworksPage):
                "name": name,
                "name": name,
                "filename": path,
                "filename": path,
                "preview": preview,
                "preview": preview,
                "prompt": f"<hypernet:{name}:1.0>",
                "prompt": json.dumps(f"<hypernet:{name}:") + " + opts.extra_networks_default_multiplier + " + json.dumps(">"),
                "local_preview": path + ".png",
                "local_preview": path + ".png",
            }
            }