Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,7 +64,7 @@ model.add_modulation_adapter(modulation_adapter)
|
|
| 64 |
if config["model"]["use_dit_lora"]:
|
| 65 |
load_dit_lora(model, model.pipe, config, dtype, device, f"{ckpt_root}", is_training=False)
|
| 66 |
|
| 67 |
-
num_inputs =
|
| 68 |
|
| 69 |
# 定义清空图像的函数,只返回四个 None
|
| 70 |
def clear_images():
|
|
@@ -137,7 +137,7 @@ accordion_states = []
|
|
| 137 |
|
| 138 |
def open_accordion_on_example_selection(*args):
|
| 139 |
print("enter open_accordion_on_example_selection")
|
| 140 |
-
images = list(args[-
|
| 141 |
outputs = []
|
| 142 |
for i, img in enumerate(images):
|
| 143 |
if img is not None:
|
|
@@ -370,7 +370,7 @@ def update_inputs(is_open, index, state: list):
|
|
| 370 |
indexs.sort()
|
| 371 |
print(indexs)
|
| 372 |
return indexs, is_open
|
| 373 |
-
|
| 374 |
if __name__ == "__main__":
|
| 375 |
|
| 376 |
with gr.Blocks() as demo:
|
|
@@ -518,9 +518,9 @@ if __name__ == "__main__":
|
|
| 518 |
3, 5,
|
| 519 |
0.85, 1.3,
|
| 520 |
0.05, 0.8,
|
| 521 |
-
"sample/hamster.jpg", None, None, None,
|
| 522 |
-
"a hamster", None, None, None,
|
| 523 |
-
False, False, False, False,
|
| 524 |
],
|
| 525 |
[
|
| 526 |
"ENT1 in a red dress is smiling",
|
|
@@ -528,9 +528,9 @@ if __name__ == "__main__":
|
|
| 528 |
3, 5,
|
| 529 |
0.85, 1.3,
|
| 530 |
0.05, 0.8,
|
| 531 |
-
"sample/woman.jpg", None, None, None,
|
| 532 |
-
"a woman", None, None, None,
|
| 533 |
-
True, False, False, False,
|
| 534 |
],
|
| 535 |
[
|
| 536 |
"ENT1 and ENT2 standing together in a park.",
|
|
@@ -538,9 +538,9 @@ if __name__ == "__main__":
|
|
| 538 |
2, 5,
|
| 539 |
0.85, 1.3,
|
| 540 |
0.05, 0.8,
|
| 541 |
-
"sample/woman.jpg", "sample/girl.jpg", None, None,
|
| 542 |
-
"a woman", "a girl", None, None,
|
| 543 |
-
True, True, False, False,
|
| 544 |
],
|
| 545 |
[
|
| 546 |
"ENT1, ENT2, and ENT3 standing together in a park.",
|
|
@@ -548,9 +548,9 @@ if __name__ == "__main__":
|
|
| 548 |
2.5, 5,
|
| 549 |
0.8, 1.2,
|
| 550 |
0.05, 0.8,
|
| 551 |
-
"sample/woman.jpg", "sample/girl.jpg", "sample/old_man.jpg", None,
|
| 552 |
-
"a woman", "a girl", "an old man", None,
|
| 553 |
-
True, True, True, False,
|
| 554 |
],
|
| 555 |
],
|
| 556 |
inputs=[
|
|
|
|
| 64 |
if config["model"]["use_dit_lora"]:
|
| 65 |
load_dit_lora(model, model.pipe, config, dtype, device, f"{ckpt_root}", is_training=False)
|
| 66 |
|
| 67 |
+
num_inputs = 4
|
| 68 |
|
| 69 |
# 定义清空图像的函数,只返回四个 None
|
| 70 |
def clear_images():
|
|
|
|
| 137 |
|
| 138 |
def open_accordion_on_example_selection(*args):
|
| 139 |
print("enter open_accordion_on_example_selection")
|
| 140 |
+
images = list(args[-num_inputs*3:-num_inputs*2])
|
| 141 |
outputs = []
|
| 142 |
for i, img in enumerate(images):
|
| 143 |
if img is not None:
|
|
|
|
| 370 |
indexs.sort()
|
| 371 |
print(indexs)
|
| 372 |
return indexs, is_open
|
| 373 |
+
|
| 374 |
if __name__ == "__main__":
|
| 375 |
|
| 376 |
with gr.Blocks() as demo:
|
|
|
|
| 518 |
3, 5,
|
| 519 |
0.85, 1.3,
|
| 520 |
0.05, 0.8,
|
| 521 |
+
"sample/hamster.jpg", None, None, None,
|
| 522 |
+
"a hamster", None, None, None,
|
| 523 |
+
False, False, False, False,
|
| 524 |
],
|
| 525 |
[
|
| 526 |
"ENT1 in a red dress is smiling",
|
|
|
|
| 528 |
3, 5,
|
| 529 |
0.85, 1.3,
|
| 530 |
0.05, 0.8,
|
| 531 |
+
"sample/woman.jpg", None, None, None,
|
| 532 |
+
"a woman", None, None, None,
|
| 533 |
+
True, False, False, False,
|
| 534 |
],
|
| 535 |
[
|
| 536 |
"ENT1 and ENT2 standing together in a park.",
|
|
|
|
| 538 |
2, 5,
|
| 539 |
0.85, 1.3,
|
| 540 |
0.05, 0.8,
|
| 541 |
+
"sample/woman.jpg", "sample/girl.jpg", None, None,
|
| 542 |
+
"a woman", "a girl", None, None,
|
| 543 |
+
True, True, False, False,
|
| 544 |
],
|
| 545 |
[
|
| 546 |
"ENT1, ENT2, and ENT3 standing together in a park.",
|
|
|
|
| 548 |
2.5, 5,
|
| 549 |
0.8, 1.2,
|
| 550 |
0.05, 0.8,
|
| 551 |
+
"sample/woman.jpg", "sample/girl.jpg", "sample/old_man.jpg", None,
|
| 552 |
+
"a woman", "a girl", "an old man", None,
|
| 553 |
+
True, True, True, False,
|
| 554 |
],
|
| 555 |
],
|
| 556 |
inputs=[
|