-
Notifications
You must be signed in to change notification settings - Fork 27.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an option to enable sections from extras tab in txt2img/img2img
fix some style inconsistenices
- Loading branch information
1 parent
645f4e7
commit 7a14c8a
Showing
9 changed files
with
133 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from modules import scripts, scripts_postprocessing, shared | ||
|
||
|
||
class ScriptPostprocessingForMainUI(scripts.Script): | ||
def __init__(self, script_postproc): | ||
self.script: scripts_postprocessing.ScriptPostprocessing = script_postproc | ||
self.postprocessing_controls = None | ||
|
||
def title(self): | ||
return self.script.name | ||
|
||
def show(self, is_img2img): | ||
return scripts.AlwaysVisible | ||
|
||
def ui(self, is_img2img): | ||
self.postprocessing_controls = self.script.ui() | ||
return self.postprocessing_controls.values() | ||
|
||
def postprocess_image(self, p, script_pp, *args): | ||
args_dict = {k: v for k, v in zip(self.postprocessing_controls, args)} | ||
|
||
pp = scripts_postprocessing.PostprocessedImage(script_pp.image) | ||
pp.info = {} | ||
self.script.process(pp, **args_dict) | ||
p.extra_generation_params.update(pp.info) | ||
script_pp.image = pp.image | ||
|
||
|
||
def create_auto_preprocessing_script_data(): | ||
from modules import scripts | ||
|
||
res = [] | ||
|
||
for name in shared.opts.postprocessing_enable_in_main_ui: | ||
script = next(iter([x for x in scripts.postprocessing_scripts_data if x.script_class.name == name]), None) | ||
if script is None: | ||
continue | ||
|
||
constructor = lambda s=script: ScriptPostprocessingForMainUI(s.script_class()) | ||
res.append(scripts.ScriptClassData(script_class=constructor, path=script.path, basedir=script.basedir, module=script.module)) | ||
|
||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
def realesrgan_models_names(): | ||
import modules.realesrgan_model | ||
return [x.name for x in modules.realesrgan_model.get_realesrgan_models(None)] | ||
|
||
def postprocessing_scripts(): | ||
import modules.scripts | ||
|
||
return modules.scripts.scripts_postproc.scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters