Update app.py
Browse files
app.py
CHANGED
@@ -56,16 +56,16 @@ def generate(input=DEFAULT_INPUT, negative_input=DEFAULT_NEGATIVE_INPUT, model=D
|
|
56 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
57 |
controlnet = ControlNetModel.from_pretrained("MakiPan/controlnet-encoded-hands-130k", torch_dtype=torch.float16)
|
58 |
repo = StableDiffusionXLPipeline.from_pretrained("cagliostrolab/animagine-xl-3.1", vae=vae, controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
|
59 |
-
steps = steps or 16
|
60 |
-
guidance = guidance or 7
|
61 |
else:
|
62 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
63 |
controlnet = ControlNetModel.from_pretrained("MakiPan/controlnet-encoded-hands-130k", torch_dtype=torch.float16)
|
64 |
repo = StableDiffusionXLPipeline.from_pretrained("sd-community/sdxl-flash", vae=vae, controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
|
65 |
repo.load_lora_weights("ehristoforu/dalle-3-xl-v2", adapter_name="base")
|
66 |
repo.set_adapters(["base"], adapter_weights=[0.7])
|
67 |
-
steps = steps or 16
|
68 |
-
guidance = guidance or 3
|
69 |
|
70 |
repo.to(DEVICE)
|
71 |
|
@@ -104,8 +104,8 @@ with gr.Blocks(css=css) as main:
|
|
104 |
model = gr.Dropdown(label="Models", choices=["Default", "Anime"], value="Default")
|
105 |
height = gr.Slider(minimum=1, maximum=2160, step=1, value=DEFAULT_HEIGHT, label="Height")
|
106 |
width = gr.Slider(minimum=1, maximum=2160, step=1, value=DEFAULT_WIDTH, label="Width")
|
107 |
-
steps = gr.Slider(minimum
|
108 |
-
guidance = gr.Slider(minimum
|
109 |
number = gr.Slider(minimum=1, maximum=4, step=1, value=1, label="Number")
|
110 |
seed = gr.Textbox(lines=1, value="", label="Seed (Blank for random)")
|
111 |
submit = gr.Button("▶")
|
|
|
56 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
57 |
controlnet = ControlNetModel.from_pretrained("MakiPan/controlnet-encoded-hands-130k", torch_dtype=torch.float16)
|
58 |
repo = StableDiffusionXLPipeline.from_pretrained("cagliostrolab/animagine-xl-3.1", vae=vae, controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
|
59 |
+
steps = (not steps or steps < 0 and 16) or steps
|
60 |
+
guidance = (not guidance or guidance < 0 and 7) or guidance
|
61 |
else:
|
62 |
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
63 |
controlnet = ControlNetModel.from_pretrained("MakiPan/controlnet-encoded-hands-130k", torch_dtype=torch.float16)
|
64 |
repo = StableDiffusionXLPipeline.from_pretrained("sd-community/sdxl-flash", vae=vae, controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
|
65 |
repo.load_lora_weights("ehristoforu/dalle-3-xl-v2", adapter_name="base")
|
66 |
repo.set_adapters(["base"], adapter_weights=[0.7])
|
67 |
+
steps = (not steps or steps < 0 and 16) or steps
|
68 |
+
guidance = (not guidance or guidance < 0 and 3) or guidance
|
69 |
|
70 |
repo.to(DEVICE)
|
71 |
|
|
|
104 |
model = gr.Dropdown(label="Models", choices=["Default", "Anime"], value="Default")
|
105 |
height = gr.Slider(minimum=1, maximum=2160, step=1, value=DEFAULT_HEIGHT, label="Height")
|
106 |
width = gr.Slider(minimum=1, maximum=2160, step=1, value=DEFAULT_WIDTH, label="Width")
|
107 |
+
steps = gr.Slider(minimum=-1, maximum=100, step=1, value=16, label="Steps")
|
108 |
+
guidance = gr.Slider(minimum=-1, maximum=100, step=0.001, value=3, label = "Guidance")
|
109 |
number = gr.Slider(minimum=1, maximum=4, step=1, value=1, label="Number")
|
110 |
seed = gr.Textbox(lines=1, value="", label="Seed (Blank for random)")
|
111 |
submit = gr.Button("▶")
|