Update app.py
Browse files
app.py
CHANGED
@@ -117,9 +117,9 @@ def update_selection(evt: gr.SelectData, selected_indices, loras_state, width, h
|
|
117 |
gr.Warning("You can select up to 2 LoRAs, remove one to select a new one.")
|
118 |
return gr.update(), gr.update(), gr.update(), selected_indices, gr.update(), gr.update(), width, height, gr.update(), gr.update()
|
119 |
|
120 |
-
selected_info_1 = "Select a LoRA 1"
|
121 |
selected_info_2 = "Select a LoRA 2"
|
122 |
-
lora_scale_1 =
|
123 |
lora_scale_2 = 1.15
|
124 |
lora_image_1 = None
|
125 |
lora_image_2 = None
|
@@ -143,9 +143,9 @@ def update_selection(evt: gr.SelectData, selected_indices, loras_state, width, h
|
|
143 |
def remove_lora_1(selected_indices, loras_state):
|
144 |
if len(selected_indices) >= 1:
|
145 |
selected_indices.pop(0)
|
146 |
-
selected_info_1 = "Select a LoRA 1"
|
147 |
selected_info_2 = "Select a LoRA 2"
|
148 |
-
lora_scale_1 =
|
149 |
lora_scale_2 = 1.15
|
150 |
lora_image_1 = None
|
151 |
lora_image_2 = None
|
@@ -162,9 +162,9 @@ def remove_lora_1(selected_indices, loras_state):
|
|
162 |
def remove_lora_2(selected_indices, loras_state):
|
163 |
if len(selected_indices) >= 2:
|
164 |
selected_indices.pop(1)
|
165 |
-
selected_info_1 = "Select LoRA 1"
|
166 |
selected_info_2 = "Select LoRA 2"
|
167 |
-
lora_scale_1 =
|
168 |
lora_scale_2 = 1.15
|
169 |
lora_image_1 = None
|
170 |
lora_image_2 = None
|
@@ -222,9 +222,9 @@ def add_custom_lora(custom_lora, selected_indices, current_loras, gallery):
|
|
222 |
gr.Warning("You can select up to 2 LoRAs, remove one to select a new one.")
|
223 |
|
224 |
# Update selected_info and images
|
225 |
-
selected_info_1 = "Select a LoRA 1"
|
226 |
selected_info_2 = "Select a LoRA 2"
|
227 |
-
lora_scale_1 =
|
228 |
lora_scale_2 = 1.15
|
229 |
lora_image_1 = None
|
230 |
lora_image_2 = None
|
@@ -267,9 +267,9 @@ def remove_custom_lora(selected_indices, current_loras, gallery):
|
|
267 |
# Update gallery
|
268 |
gallery_items = [(item["image"], item["title"]) for item in current_loras]
|
269 |
# Update selected_info and images
|
270 |
-
selected_info_1 = "Select a LoRA 1"
|
271 |
selected_info_2 = "Select a LoRA 2"
|
272 |
-
lora_scale_1 =
|
273 |
lora_scale_2 = 1.15
|
274 |
lora_image_1 = None
|
275 |
lora_image_2 = None
|
@@ -396,7 +396,7 @@ def run_lora(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scal
|
|
396 |
image_generator = generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
|
397 |
# Consume the generator to get the final image
|
398 |
# final_image = None
|
399 |
-
|
400 |
for image in image_generator:
|
401 |
step_counter += 1
|
402 |
final_image = image
|
@@ -552,7 +552,7 @@ with gr.Blocks(css=css, delete_cache=(240, 240)) as app:
|
|
552 |
# remove_button_4 = gr.Button("Remove", size="sm")
|
553 |
|
554 |
with gr.Row():
|
555 |
-
with gr.Accordion("Advanced Settings", open=
|
556 |
#with gr.Row():
|
557 |
# input_image = gr.Image(label="Input image", type="filepath", show_share_button=False)
|
558 |
# image_strength = gr.Slider(label="Denoise Strength", info="Lower means more image influence", minimum=0.1, maximum=1.0, step=0.01, value=0.75)
|
@@ -562,7 +562,7 @@ with gr.Blocks(css=css, delete_cache=(240, 240)) as app:
|
|
562 |
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=28)
|
563 |
|
564 |
with gr.Row():
|
565 |
-
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=
|
566 |
height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
|
567 |
|
568 |
with gr.Row():
|
|
|
117 |
gr.Warning("You can select up to 2 LoRAs, remove one to select a new one.")
|
118 |
return gr.update(), gr.update(), gr.update(), selected_indices, gr.update(), gr.update(), width, height, gr.update(), gr.update()
|
119 |
|
120 |
+
selected_info_1 = "Select a Celebrity as LoRA 1"
|
121 |
selected_info_2 = "Select a LoRA 2"
|
122 |
+
lora_scale_1 = 0.6
|
123 |
lora_scale_2 = 1.15
|
124 |
lora_image_1 = None
|
125 |
lora_image_2 = None
|
|
|
143 |
def remove_lora_1(selected_indices, loras_state):
|
144 |
if len(selected_indices) >= 1:
|
145 |
selected_indices.pop(0)
|
146 |
+
selected_info_1 = "Select a Celebrity as LoRA 1"
|
147 |
selected_info_2 = "Select a LoRA 2"
|
148 |
+
lora_scale_1 = 0.6
|
149 |
lora_scale_2 = 1.15
|
150 |
lora_image_1 = None
|
151 |
lora_image_2 = None
|
|
|
162 |
def remove_lora_2(selected_indices, loras_state):
|
163 |
if len(selected_indices) >= 2:
|
164 |
selected_indices.pop(1)
|
165 |
+
selected_info_1 = "Select a Celebrity as LoRA 1"
|
166 |
selected_info_2 = "Select LoRA 2"
|
167 |
+
lora_scale_1 = 0.6
|
168 |
lora_scale_2 = 1.15
|
169 |
lora_image_1 = None
|
170 |
lora_image_2 = None
|
|
|
222 |
gr.Warning("You can select up to 2 LoRAs, remove one to select a new one.")
|
223 |
|
224 |
# Update selected_info and images
|
225 |
+
selected_info_1 = "Select a Celebrity as LoRA 1"
|
226 |
selected_info_2 = "Select a LoRA 2"
|
227 |
+
lora_scale_1 = 0.6
|
228 |
lora_scale_2 = 1.15
|
229 |
lora_image_1 = None
|
230 |
lora_image_2 = None
|
|
|
267 |
# Update gallery
|
268 |
gallery_items = [(item["image"], item["title"]) for item in current_loras]
|
269 |
# Update selected_info and images
|
270 |
+
selected_info_1 = "Select a Celebrity as LoRA 1"
|
271 |
selected_info_2 = "Select a LoRA 2"
|
272 |
+
lora_scale_1 = 0.6
|
273 |
lora_scale_2 = 1.15
|
274 |
lora_image_1 = None
|
275 |
lora_image_2 = None
|
|
|
396 |
image_generator = generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
|
397 |
# Consume the generator to get the final image
|
398 |
# final_image = None
|
399 |
+
step_counter = 0
|
400 |
for image in image_generator:
|
401 |
step_counter += 1
|
402 |
final_image = image
|
|
|
552 |
# remove_button_4 = gr.Button("Remove", size="sm")
|
553 |
|
554 |
with gr.Row():
|
555 |
+
with gr.Accordion("Advanced Settings", open=True):
|
556 |
#with gr.Row():
|
557 |
# input_image = gr.Image(label="Input image", type="filepath", show_share_button=False)
|
558 |
# image_strength = gr.Slider(label="Denoise Strength", info="Lower means more image influence", minimum=0.1, maximum=1.0, step=0.01, value=0.75)
|
|
|
562 |
steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=28)
|
563 |
|
564 |
with gr.Row():
|
565 |
+
width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=768)
|
566 |
height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
|
567 |
|
568 |
with gr.Row():
|