sdh external
This commit is contained in:
parent
0685549673
commit
c3cdab663b
31
gradio_ui.py
31
gradio_ui.py
|
@ -56,8 +56,13 @@ def compare_dicts(a, b):
|
|||
return c
|
||||
|
||||
class BlendingFrontend():
|
||||
def __init__(self):
|
||||
def __init__(self, sdh=None):
|
||||
if sdh is None:
|
||||
self.use_debug = True
|
||||
else:
|
||||
self.use_debug = False
|
||||
self.lb = LatentBlending(sdh)
|
||||
|
||||
self.share = True
|
||||
|
||||
self.num_inference_steps = 30
|
||||
|
@ -70,7 +75,7 @@ class BlendingFrontend():
|
|||
self.prompt1 = ""
|
||||
self.prompt2 = ""
|
||||
self.negative_prompt = ""
|
||||
self.dp_base = "/home/lugo/latentblending"
|
||||
self.dp_base = "/output/"
|
||||
self.list_settings = []
|
||||
self.state_prev = {}
|
||||
self.state_current = {}
|
||||
|
@ -84,24 +89,13 @@ class BlendingFrontend():
|
|||
self.duration = 10
|
||||
|
||||
if not self.use_debug:
|
||||
self.init_diffusion()
|
||||
self.lb.sdh.num_inference_steps = self.num_inference_steps
|
||||
self.height = self.lb.sdh.height
|
||||
self.width = self.lb.sdh.width
|
||||
else:
|
||||
self.height = 420
|
||||
self.width = 420
|
||||
|
||||
def init_diffusion(self):
|
||||
fp_ckpt = "../stable_diffusion_models/ckpt/v2-1_512-ema-pruned.ckpt"
|
||||
fp_config = 'configs/v2-inference.yaml'
|
||||
|
||||
# fp_ckpt = "../stable_diffusion_models/ckpt/v2-1_768-ema-pruned.ckpt"
|
||||
# fp_config = 'configs/v2-inference-v.yaml'
|
||||
|
||||
sdh = StableDiffusionHolder(fp_ckpt, fp_config, num_inference_steps=self.num_inference_steps)
|
||||
self.lb = LatentBlending(sdh)
|
||||
self.use_debug = False
|
||||
|
||||
def change_depth_strength(self, value):
|
||||
self.depth_strength = value
|
||||
print(f"changed depth_strength to {value}")
|
||||
|
@ -284,7 +278,14 @@ class BlendingFrontend():
|
|||
list_return.extend([str_fill])
|
||||
return list_return
|
||||
|
||||
self = BlendingFrontend()
|
||||
if __name__ == "__main__":
|
||||
|
||||
fp_ckpt = "../stable_diffusion_models/ckpt/v2-1_512-ema-pruned.ckpt"
|
||||
fp_config = 'configs/v2-inference.yaml'
|
||||
|
||||
sdh = StableDiffusionHolder(fp_ckpt, fp_config)
|
||||
|
||||
self = BlendingFrontend(sdh)
|
||||
|
||||
|
||||
with gr.Blocks() as demo:
|
||||
|
|
Loading…
Reference in New Issue