This commit is contained in:
lllyasviel
2024-01-29 07:38:38 -08:00
parent 269e87484f
commit bd334d3aff
4 changed files with 16 additions and 6 deletions

View File

@@ -534,9 +534,8 @@ class PreprocessorNormalBae(Preprocessor):
def __init__(self):
super().__init__()
self.name = 'normalbae'
self.tag = 'NormalMap'
self.slider_resolution = PreprocessorParameter(
label='Resolution', minimum=128, maximum=2048, value=512, step=8, visible=True)
self.tags = ['NormalMap']
self.slider_resolution = PreprocessorParameter(label='Resolution', minimum=128, maximum=2048, value=512, step=8, visible=True)
self.slider_1 = PreprocessorParameter(visible=False)
self.slider_2 = PreprocessorParameter(visible=False)
self.slider_3 = PreprocessorParameter(visible=False)

View File

@@ -16,7 +16,7 @@ class PreprocessorNormalBae(Preprocessor):
def __init__(self):
super().__init__()
self.name = 'normalbae'
self.tag = 'NormalMap'
self.tags = ['NormalMap']
self.slider_resolution = PreprocessorParameter(label='Resolution', minimum=128, maximum=2048, value=512, step=8, visible=True)
self.slider_1 = PreprocessorParameter(visible=False)
self.slider_2 = PreprocessorParameter(visible=False)

View File

@@ -78,6 +78,17 @@ class ControlNetExampleForge(scripts.Script):
input_image = cv2.resize(input_image, (width, height))
canny_image = cv2.cvtColor(cv2.Canny(input_image, 100, 200), cv2.COLOR_GRAY2RGB)
from modules_forge.ops import capture_model
from modules_forge.shared import shared_preprocessors
with capture_model() as captured_model:
canny_image = shared_preprocessors['normalbae'](input_image, 512)
captured_model.cpu()
from ldm_patched.modules import model_management
model_management.soft_empty_cache()
a = 0
# # Or you can get a list of preprocessors in this way
# from modules_forge.shared import shared_preprocessors
# canny_preprocessor = shared_preprocessors['canny']

View File

@@ -34,7 +34,7 @@ class PreprocessorParameter:
class Preprocessor:
def __init__(self):
self.name = 'PreprocessorBase'
self.tag = None
self.tags = []
self.slider_resolution = PreprocessorParameter(label='Resolution', minimum=128, maximum=2048, value=512, step=8, visible=True)
self.slider_1 = PreprocessorParameter()
self.slider_2 = PreprocessorParameter()
@@ -94,7 +94,7 @@ class PreprocessorCanny(Preprocessor):
def __init__(self):
super().__init__()
self.name = 'canny'
self.tag = 'Canny'
self.tags = ['Canny']
self.slider_1 = PreprocessorParameter(minimum=0, maximum=256, step=1, value=100, label='Low Threshold', visible=True)
self.slider_2 = PreprocessorParameter(minimum=0, maximum=256, step=1, value=200, label='High Threshold', visible=True)