Spaces:
Runtime error
Runtime error
eyal.benaroche
commited on
Commit
·
40d6202
1
Parent(s):
d8ef2e5
rescale inside inference
Browse files
app.py
CHANGED
|
@@ -39,12 +39,6 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
| 39 |
MAX_IMAGE_SIZE = 1024
|
| 40 |
|
| 41 |
|
| 42 |
-
def rescale_lora(user_lora_weight):
|
| 43 |
-
|
| 44 |
-
global pipe
|
| 45 |
-
pipe.set_adapters(["lora", "user"], adapter_weights=[1.0, user_lora_weight])
|
| 46 |
-
|
| 47 |
-
|
| 48 |
def update_selection(
|
| 49 |
selected_state: gr.SelectData,
|
| 50 |
gr_sdxl_loras,
|
|
@@ -67,7 +61,7 @@ def infer(
|
|
| 67 |
guidance_scale,
|
| 68 |
user_lora_selector,
|
| 69 |
user_lora_weight,
|
| 70 |
-
progress=gr.Progress(track_tqdm=True)
|
| 71 |
):
|
| 72 |
flash_sdxl_id = "jasperai/flash-sdxl"
|
| 73 |
|
|
@@ -106,7 +100,7 @@ def infer(
|
|
| 106 |
generator=generator,
|
| 107 |
).images[0]
|
| 108 |
|
| 109 |
-
return image
|
| 110 |
|
| 111 |
|
| 112 |
css = """
|
|
@@ -271,19 +265,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 271 |
negative_prompt,
|
| 272 |
guidance_scale,
|
| 273 |
user_lora_selector,
|
| 274 |
-
user_lora_weight
|
| 275 |
],
|
| 276 |
outputs=[result],
|
| 277 |
# show_progress="full",
|
| 278 |
)
|
| 279 |
|
| 280 |
-
user_lora_weight.change(
|
| 281 |
-
fn=rescale_lora,
|
| 282 |
-
inputs=[user_lora_weight],
|
| 283 |
-
outputs=[],
|
| 284 |
-
show_progress="hidden",
|
| 285 |
-
)
|
| 286 |
-
|
| 287 |
gallery.select(
|
| 288 |
fn=update_selection,
|
| 289 |
inputs=[gr_sdxl_loras],
|
|
|
|
| 39 |
MAX_IMAGE_SIZE = 1024
|
| 40 |
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
def update_selection(
|
| 43 |
selected_state: gr.SelectData,
|
| 44 |
gr_sdxl_loras,
|
|
|
|
| 61 |
guidance_scale,
|
| 62 |
user_lora_selector,
|
| 63 |
user_lora_weight,
|
| 64 |
+
progress=gr.Progress(track_tqdm=True),
|
| 65 |
):
|
| 66 |
flash_sdxl_id = "jasperai/flash-sdxl"
|
| 67 |
|
|
|
|
| 100 |
generator=generator,
|
| 101 |
).images[0]
|
| 102 |
|
| 103 |
+
return image
|
| 104 |
|
| 105 |
|
| 106 |
css = """
|
|
|
|
| 265 |
negative_prompt,
|
| 266 |
guidance_scale,
|
| 267 |
user_lora_selector,
|
| 268 |
+
user_lora_weight,
|
| 269 |
],
|
| 270 |
outputs=[result],
|
| 271 |
# show_progress="full",
|
| 272 |
)
|
| 273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
gallery.select(
|
| 275 |
fn=update_selection,
|
| 276 |
inputs=[gr_sdxl_loras],
|