i
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
def preload(parser):
|
||||||
|
parser.add_argument(
|
||||||
|
"--show-controlnet-example",
|
||||||
|
action="store_true",
|
||||||
|
help="Show development example extension for ControlNet.",
|
||||||
|
)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import gradio as gr
|
||||||
|
|
||||||
|
from modules import scripts
|
||||||
|
from modules.shared_cmd_options import cmd_opts
|
||||||
|
|
||||||
|
|
||||||
|
class ControlNetExampleForge(scripts.Script):
|
||||||
|
def title(self):
|
||||||
|
return "ControlNet Example for Developers"
|
||||||
|
|
||||||
|
def show(self, is_img2img):
|
||||||
|
# make this extension visible in both txt2img and img2img tab.
|
||||||
|
return scripts.AlwaysVisible
|
||||||
|
|
||||||
|
def ui(self, *args, **kwargs):
|
||||||
|
with gr.Accordion(open=False, label=self.title()):
|
||||||
|
gr.HTML('This is an example controlnet extension for developers.')
|
||||||
|
gr.HTML('You see this extension because you used --show-controlnet-example')
|
||||||
|
input_image = gr.Image(source='upload', type='numpy')
|
||||||
|
funny_slider = gr.Slider(label='This slider does nothing. It just shows you how to transfer parameters.')
|
||||||
|
|
||||||
|
return input_image, funny_slider
|
||||||
|
|
||||||
|
def process_batch(self, p, *script_args, **kwargs):
|
||||||
|
input_image, funny_slider = script_args
|
||||||
|
|
||||||
|
# This slider does nothing. It just shows you how to transfer parameters.
|
||||||
|
del funny_slider
|
||||||
|
|
||||||
|
if input_image is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
print('Input image is read')
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
# Use --show-controlnet-example to see this extension.
|
||||||
|
if not cmd_opts.show_controlnet_example:
|
||||||
|
del ControlNetExampleForge
|
||||||
Reference in New Issue
Block a user