Spaces:
Sleeping
Sleeping
setup_lora_scale
Browse files
app.py
CHANGED
|
@@ -89,25 +89,44 @@ with gr.Blocks(css=css) as demo:
|
|
| 89 |
model_id = gr.Dropdown(
|
| 90 |
choices=["CompVis/stable-diffusion-v1-4", "stabilityai/sdxl-turbo"], info="Choose model")
|
| 91 |
|
| 92 |
-
with gr.Row():
|
| 93 |
lora = gr.Dropdown(
|
| 94 |
choices=["None", "pepe"], info="Choose lora", visible=True)
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
def setup_lora(selected_option):
|
| 97 |
if selected_option == "CompVis/stable-diffusion-v1-4":
|
| 98 |
return gr.Dropdown(choices=["None", "pepe"], info="Choose lora", visible=True)
|
| 99 |
else:
|
| 100 |
return gr.Dropdown(choices=["None", "pepe"], info="Choose lora", visible=False)
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
model_id.change(
|
| 103 |
fn=setup_lora,
|
| 104 |
inputs=model_id,
|
| 105 |
outputs=lora)
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
with gr.Row():
|
| 108 |
del_back = gr.Checkbox(label="Delete background", value=False)
|
| 109 |
|
| 110 |
-
with gr.Row():
|
| 111 |
prompt = gr.Text(
|
| 112 |
label="Prompt",
|
| 113 |
show_label=False,
|
|
@@ -158,7 +177,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 158 |
value=1024, # Replace with defaults that work for your model
|
| 159 |
)
|
| 160 |
|
| 161 |
-
with gr.Row():
|
| 162 |
guidance_scale = gr.Slider(
|
| 163 |
label="Guidance scale",
|
| 164 |
minimum=0.0,
|
|
|
|
| 89 |
model_id = gr.Dropdown(
|
| 90 |
choices=["CompVis/stable-diffusion-v1-4", "stabilityai/sdxl-turbo"], info="Choose model")
|
| 91 |
|
|
|
|
| 92 |
lora = gr.Dropdown(
|
| 93 |
choices=["None", "pepe"], info="Choose lora", visible=True)
|
| 94 |
|
| 95 |
+
lora_scale = gr.Slider(
|
| 96 |
+
label="scale lora strength",
|
| 97 |
+
minimum=0.0,
|
| 98 |
+
maximum=2.0,
|
| 99 |
+
step=0.1,
|
| 100 |
+
value=1.0,
|
| 101 |
+
visible=False,
|
| 102 |
+
info="Adjust LoRA adapter strength"
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
def setup_lora(selected_option):
|
| 106 |
if selected_option == "CompVis/stable-diffusion-v1-4":
|
| 107 |
return gr.Dropdown(choices=["None", "pepe"], info="Choose lora", visible=True)
|
| 108 |
else:
|
| 109 |
return gr.Dropdown(choices=["None", "pepe"], info="Choose lora", visible=False)
|
| 110 |
+
|
| 111 |
+
def setup_lora_scale(selected_option):
|
| 112 |
+
if selected_option == "None":
|
| 113 |
+
return gr.Dropdown(choices=["None", "pepe"], info="Choose lora", visible=False)
|
| 114 |
+
else:
|
| 115 |
+
return gr.Dropdown(choices=["None", "pepe"], info="Choose lora", visible=True)
|
| 116 |
+
|
| 117 |
model_id.change(
|
| 118 |
fn=setup_lora,
|
| 119 |
inputs=model_id,
|
| 120 |
outputs=lora)
|
| 121 |
+
|
| 122 |
+
lora.change(
|
| 123 |
+
fn=setup_lora_scale,
|
| 124 |
+
inputs=lora,
|
| 125 |
+
outputs=lora_scale)
|
| 126 |
+
|
| 127 |
with gr.Row():
|
| 128 |
del_back = gr.Checkbox(label="Delete background", value=False)
|
| 129 |
|
|
|
|
| 130 |
prompt = gr.Text(
|
| 131 |
label="Prompt",
|
| 132 |
show_label=False,
|
|
|
|
| 177 |
value=1024, # Replace with defaults that work for your model
|
| 178 |
)
|
| 179 |
|
|
|
|
| 180 |
guidance_scale = gr.Slider(
|
| 181 |
label="Guidance scale",
|
| 182 |
minimum=0.0,
|