MCPcopy Create free account
hub / github.com/DenOfEquity/ersatzForge / ui

Method ui

modules/processing_scripts/refiner.py:22–43  ·  view source on GitHub ↗
(self, is_img2img)

Source from the content-addressed store, hash-verified

20 return scripts.AlwaysVisible
21
22 def ui(self, is_img2img):
23 choices = ([""] if is_img2img else ["", "[STOP]"]) + sd_models.checkpoint_tiles()
24
25 with InputAccordion(False, label="Refiner", elem_id=self.elem_id("enable")) as enable_refiner:
26 with gr.Row():
27 refiner_checkpoint = gr.Dropdown(show_label=False, label="Refiner", info="(use model of same architecture)", elem_id=self.elem_id("checkpoint"), choices=choices, value="", tooltip="switch to another model in the middle of generation")
28
29 refiner_switch_at = gr.Slider(value=0.8, label="Switch at", minimum=0.01, maximum=1.0, step=0.01, elem_id=self.elem_id("switch_at"), tooltip="fraction of sampling steps when the switch to refiner model should happen; 1=never, 0.5=switch in the middle of generation")
30
31 self.infotext_fields = [
32 PasteField(enable_refiner, lambda d: "Refiner" in d),
33 PasteField(refiner_checkpoint, "Refiner", api="refiner_checkpoint"),
34 PasteField(refiner_switch_at, "Refiner switch at", api="refiner_switch_at"),
35 ]
36
37 return enable_refiner, refiner_checkpoint, refiner_switch_at
38
39 def setup(self, p, enable_refiner, refiner_checkpoint, refiner_switch_at):
40 # the actual implementation is in sd_samplers_common.py, apply_refiner
41 if not enable_refiner or refiner_checkpoint in (None, ""):
42 p.refiner_checkpoint = None
43 p.refiner_switch_at = None
44 else:
45 p.refiner_checkpoint = refiner_checkpoint
46 p.refiner_switch_at = refiner_switch_at

Callers

nothing calls this directly

Calls 5

InputAccordionFunction · 0.90
create_refresh_buttonFunction · 0.90
PasteFieldClass · 0.90
getMethod · 0.80
elem_idMethod · 0.45

Tested by

no test coverage detected