diff options
author | JashoBell <JoshuaDB@gmail.com> | 2022-09-17 19:43:57 +0000 |
---|---|---|
committer | JashoBell <JoshuaDB@gmail.com> | 2022-09-17 19:43:57 +0000 |
commit | 98a6644bcff5765b916af6234448f6bf3dbffddc (patch) | |
tree | ac1cb35d515d4d1f8f9dedd42bb95b81acb83353 /scripts/custom_code.py | |
parent | d2c7ad2fec09d89d1348d6d40640259b5a02b8ad (diff) | |
download | stable-diffusion-webui-gfx803-98a6644bcff5765b916af6234448f6bf3dbffddc.tar.gz stable-diffusion-webui-gfx803-98a6644bcff5765b916af6234448f6bf3dbffddc.tar.bz2 stable-diffusion-webui-gfx803-98a6644bcff5765b916af6234448f6bf3dbffddc.zip |
Move comments to scripts.py
Diffstat (limited to 'scripts/custom_code.py')
-rw-r--r-- | scripts/custom_code.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/scripts/custom_code.py b/scripts/custom_code.py index 6583d3b8..a9b10c09 100644 --- a/scripts/custom_code.py +++ b/scripts/custom_code.py @@ -4,38 +4,21 @@ import gradio as gr from modules.processing import Processed
from modules.shared import opts, cmd_opts, state
-# An example custom script that allows you to make modifications to how the model object is handled.
-# These scripts appear in the lower-left dropdown menu on the txt2img and img2img tabs.
class Script(scripts.Script):
- # The title of the script. This is what will be displayed in the dropdown menu.
def title(self):
return "Custom code"
- # Determines when the script should be shown in the dropdown menu via the returned value.
- # is_img2img is True if the current tab is img2img, and False if it is txt2img. Thus, return
- # is_img2img to only show the script on the img2img tab.
def show(self, is_img2img):
return cmd_opts.allow_code
-
- # How the script's is displayed in the UI. See https://gradio.app/docs/#components
- # for the different elements you can use and how to specify them.
- # Each UI element can return a value, such as a boolean for a checkbox.
- # The returned values are passed to the run method as parameters.
def ui(self, is_img2img):
code = gr.Textbox(label="Python code", visible=False, lines=1)
return [code]
- # This is where the additional processing is implemented. The parameters include self, the
- # model object (a StableDiffusionProcessing class, see processing.py), and the parameters
- # returned by the ui method.
- # Custom functions can be defined here, and additional libraries can be imported to be used
- # in processing. The return value should be a Processed object, which is what is returned
- # by the process_images method.
def run(self, p, code):
assert cmd_opts.allow_code, '--allow-code option must be enabled'
|