Spaces:
Runtime error
Runtime error
set separate_cfg_infer=True
Browse files
app.py
CHANGED
|
@@ -26,10 +26,10 @@ def generate_image(text, img1, img2, img3, height, width, guidance_scale, img_gu
|
|
| 26 |
guidance_scale=guidance_scale,
|
| 27 |
img_guidance_scale=1.6,
|
| 28 |
num_inference_steps=inference_steps,
|
| 29 |
-
|
| 30 |
use_kv_cache=False,
|
| 31 |
seed=seed,
|
| 32 |
-
separate_cfg_infer=separate_cfg_infer,
|
| 33 |
)
|
| 34 |
img = output[0]
|
| 35 |
return img
|
|
@@ -58,7 +58,7 @@ def get_example():
|
|
| 58 |
1.6,
|
| 59 |
50,
|
| 60 |
0,
|
| 61 |
-
|
| 62 |
],
|
| 63 |
[
|
| 64 |
"The woman in <img><|image_1|></img> waves her hand happily in the crowd",
|
|
@@ -71,7 +71,7 @@ def get_example():
|
|
| 71 |
1.9,
|
| 72 |
50,
|
| 73 |
128,
|
| 74 |
-
|
| 75 |
],
|
| 76 |
[
|
| 77 |
"A man in a black shirt is reading a book. The man is the right man in <img><|image_1|></img>.",
|
|
@@ -84,7 +84,7 @@ def get_example():
|
|
| 84 |
1.6,
|
| 85 |
50,
|
| 86 |
0,
|
| 87 |
-
|
| 88 |
],
|
| 89 |
[
|
| 90 |
"Two woman are raising fried chicken legs in a bar. A woman is <img><|image_1|></img>. The other woman is <img><|image_2|></img>.",
|
|
@@ -97,7 +97,7 @@ def get_example():
|
|
| 97 |
1.8,
|
| 98 |
50,
|
| 99 |
168,
|
| 100 |
-
|
| 101 |
],
|
| 102 |
[
|
| 103 |
"A man and a short-haired woman with a wrinkled face are standing in front of a bookshelf in a library. The man is the man in the middle of <img><|image_1|></img>, and the woman is oldest woman in <img><|image_2|></img>",
|
|
@@ -110,7 +110,7 @@ def get_example():
|
|
| 110 |
1.6,
|
| 111 |
50,
|
| 112 |
60,
|
| 113 |
-
|
| 114 |
],
|
| 115 |
[
|
| 116 |
"A man and a woman are sitting at a classroom desk. The man is the man with yellow hair in <img><|image_1|></img>. The woman is the woman on the left of <img><|image_2|></img>",
|
|
@@ -123,7 +123,7 @@ def get_example():
|
|
| 123 |
1.8,
|
| 124 |
50,
|
| 125 |
66,
|
| 126 |
-
|
| 127 |
],
|
| 128 |
[
|
| 129 |
"The flower <img><|image_1|><\/img> is placed in the vase which is in the middle of <img><|image_2|><\/img> on a wooden table of a living room",
|
|
@@ -136,7 +136,7 @@ def get_example():
|
|
| 136 |
1.6,
|
| 137 |
50,
|
| 138 |
0,
|
| 139 |
-
|
| 140 |
],
|
| 141 |
[
|
| 142 |
"<img><|image_1|><img>\n Remove the woman's earrings. Replace the mug with a clear glass filled with sparkling iced cola.",
|
|
@@ -149,7 +149,7 @@ def get_example():
|
|
| 149 |
1.6,
|
| 150 |
50,
|
| 151 |
222,
|
| 152 |
-
|
| 153 |
],
|
| 154 |
[
|
| 155 |
"Detect the skeleton of human in this image: <img><|image_1|></img>.",
|
|
@@ -162,7 +162,7 @@ def get_example():
|
|
| 162 |
1.6,
|
| 163 |
50,
|
| 164 |
0,
|
| 165 |
-
|
| 166 |
],
|
| 167 |
[
|
| 168 |
"Generate a new photo using the following picture and text as conditions: <img><|image_1|><img>\n A young boy is sitting on a sofa in the library, holding a book. His hair is neatly combed, and a faint smile plays on his lips, with a few freckles scattered across his cheeks. The library is quiet, with rows of shelves filled with books stretching out behind him.",
|
|
@@ -175,7 +175,7 @@ def get_example():
|
|
| 175 |
1.6,
|
| 176 |
50,
|
| 177 |
42,
|
| 178 |
-
|
| 179 |
],
|
| 180 |
[
|
| 181 |
"Following the pose of this image <img><|image_1|><img>, generate a new photo: A young boy is sitting on a sofa in the library, holding a book. His hair is neatly combed, and a faint smile plays on his lips, with a few freckles scattered across his cheeks. The library is quiet, with rows of shelves filled with books stretching out behind him.",
|
|
@@ -188,7 +188,7 @@ def get_example():
|
|
| 188 |
1.6,
|
| 189 |
50,
|
| 190 |
123,
|
| 191 |
-
|
| 192 |
],
|
| 193 |
[
|
| 194 |
"Following the depth mapping of this image <img><|image_1|><img>, generate a new photo: A young girl is sitting on a sofa in the library, holding a book. His hair is neatly combed, and a faint smile plays on his lips, with a few freckles scattered across his cheeks. The library is quiet, with rows of shelves filled with books stretching out behind him.",
|
|
@@ -201,7 +201,7 @@ def get_example():
|
|
| 201 |
1.6,
|
| 202 |
50,
|
| 203 |
1,
|
| 204 |
-
|
| 205 |
],
|
| 206 |
[
|
| 207 |
"<img><|image_1|><\/img> What item can be used to see the current time? Please remove it.",
|
|
@@ -214,7 +214,7 @@ def get_example():
|
|
| 214 |
1.6,
|
| 215 |
50,
|
| 216 |
0,
|
| 217 |
-
|
| 218 |
],
|
| 219 |
[
|
| 220 |
"According to the following examples, generate an output for the input.\nInput: <img><|image_1|></img>\nOutput: <img><|image_2|></img>\n\nInput: <img><|image_3|></img>\nOutput: ",
|
|
@@ -227,7 +227,7 @@ def get_example():
|
|
| 227 |
1.6,
|
| 228 |
50,
|
| 229 |
1,
|
| 230 |
-
|
| 231 |
],
|
| 232 |
]
|
| 233 |
return case
|
|
|
|
| 26 |
guidance_scale=guidance_scale,
|
| 27 |
img_guidance_scale=1.6,
|
| 28 |
num_inference_steps=inference_steps,
|
| 29 |
+
separate_cfg_infer=True, # set False can speed up the inference process
|
| 30 |
use_kv_cache=False,
|
| 31 |
seed=seed,
|
| 32 |
+
# separate_cfg_infer=separate_cfg_infer,
|
| 33 |
)
|
| 34 |
img = output[0]
|
| 35 |
return img
|
|
|
|
| 58 |
1.6,
|
| 59 |
50,
|
| 60 |
0,
|
| 61 |
+
True,
|
| 62 |
],
|
| 63 |
[
|
| 64 |
"The woman in <img><|image_1|></img> waves her hand happily in the crowd",
|
|
|
|
| 71 |
1.9,
|
| 72 |
50,
|
| 73 |
128,
|
| 74 |
+
True,
|
| 75 |
],
|
| 76 |
[
|
| 77 |
"A man in a black shirt is reading a book. The man is the right man in <img><|image_1|></img>.",
|
|
|
|
| 84 |
1.6,
|
| 85 |
50,
|
| 86 |
0,
|
| 87 |
+
True,
|
| 88 |
],
|
| 89 |
[
|
| 90 |
"Two woman are raising fried chicken legs in a bar. A woman is <img><|image_1|></img>. The other woman is <img><|image_2|></img>.",
|
|
|
|
| 97 |
1.8,
|
| 98 |
50,
|
| 99 |
168,
|
| 100 |
+
True,
|
| 101 |
],
|
| 102 |
[
|
| 103 |
"A man and a short-haired woman with a wrinkled face are standing in front of a bookshelf in a library. The man is the man in the middle of <img><|image_1|></img>, and the woman is oldest woman in <img><|image_2|></img>",
|
|
|
|
| 110 |
1.6,
|
| 111 |
50,
|
| 112 |
60,
|
| 113 |
+
True,
|
| 114 |
],
|
| 115 |
[
|
| 116 |
"A man and a woman are sitting at a classroom desk. The man is the man with yellow hair in <img><|image_1|></img>. The woman is the woman on the left of <img><|image_2|></img>",
|
|
|
|
| 123 |
1.8,
|
| 124 |
50,
|
| 125 |
66,
|
| 126 |
+
True,
|
| 127 |
],
|
| 128 |
[
|
| 129 |
"The flower <img><|image_1|><\/img> is placed in the vase which is in the middle of <img><|image_2|><\/img> on a wooden table of a living room",
|
|
|
|
| 136 |
1.6,
|
| 137 |
50,
|
| 138 |
0,
|
| 139 |
+
True,
|
| 140 |
],
|
| 141 |
[
|
| 142 |
"<img><|image_1|><img>\n Remove the woman's earrings. Replace the mug with a clear glass filled with sparkling iced cola.",
|
|
|
|
| 149 |
1.6,
|
| 150 |
50,
|
| 151 |
222,
|
| 152 |
+
True,
|
| 153 |
],
|
| 154 |
[
|
| 155 |
"Detect the skeleton of human in this image: <img><|image_1|></img>.",
|
|
|
|
| 162 |
1.6,
|
| 163 |
50,
|
| 164 |
0,
|
| 165 |
+
True,
|
| 166 |
],
|
| 167 |
[
|
| 168 |
"Generate a new photo using the following picture and text as conditions: <img><|image_1|><img>\n A young boy is sitting on a sofa in the library, holding a book. His hair is neatly combed, and a faint smile plays on his lips, with a few freckles scattered across his cheeks. The library is quiet, with rows of shelves filled with books stretching out behind him.",
|
|
|
|
| 175 |
1.6,
|
| 176 |
50,
|
| 177 |
42,
|
| 178 |
+
True,
|
| 179 |
],
|
| 180 |
[
|
| 181 |
"Following the pose of this image <img><|image_1|><img>, generate a new photo: A young boy is sitting on a sofa in the library, holding a book. His hair is neatly combed, and a faint smile plays on his lips, with a few freckles scattered across his cheeks. The library is quiet, with rows of shelves filled with books stretching out behind him.",
|
|
|
|
| 188 |
1.6,
|
| 189 |
50,
|
| 190 |
123,
|
| 191 |
+
True,
|
| 192 |
],
|
| 193 |
[
|
| 194 |
"Following the depth mapping of this image <img><|image_1|><img>, generate a new photo: A young girl is sitting on a sofa in the library, holding a book. His hair is neatly combed, and a faint smile plays on his lips, with a few freckles scattered across his cheeks. The library is quiet, with rows of shelves filled with books stretching out behind him.",
|
|
|
|
| 201 |
1.6,
|
| 202 |
50,
|
| 203 |
1,
|
| 204 |
+
True,
|
| 205 |
],
|
| 206 |
[
|
| 207 |
"<img><|image_1|><\/img> What item can be used to see the current time? Please remove it.",
|
|
|
|
| 214 |
1.6,
|
| 215 |
50,
|
| 216 |
0,
|
| 217 |
+
True,
|
| 218 |
],
|
| 219 |
[
|
| 220 |
"According to the following examples, generate an output for the input.\nInput: <img><|image_1|></img>\nOutput: <img><|image_2|></img>\n\nInput: <img><|image_3|></img>\nOutput: ",
|
|
|
|
| 227 |
1.6,
|
| 228 |
50,
|
| 229 |
1,
|
| 230 |
+
True,
|
| 231 |
],
|
| 232 |
]
|
| 233 |
return case
|