Songwei Ge commited on
Commit
ed9d237
1 Parent(s): fb8cc1d
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -35,6 +35,7 @@ def main():
35
  seed: int,
36
  steps: int,
37
  guidance_weight: float,
 
38
  ):
39
  run_dir = 'results/'
40
  # Load region diffusion model.
@@ -57,7 +58,7 @@ def main():
57
 
58
  # create control input for region guidance
59
  text_format_dict, color_target_token_ids = get_gradient_guidance_input(
60
- model, base_tokens, color_text_prompts, color_rgbs, text_format_dict)
61
 
62
  seed_everything(seed)
63
 
@@ -148,6 +149,7 @@ def main():
148
  512,
149
  512,
150
  6,
 
151
  ],
152
  [
153
  '{"ops": [{"insert": "A pizza with "}, {"attributes": {"size": "50px"}, "insert": "pineapples"}, {"insert": ", pepperonis, and mushrooms on the top, 4k, photorealistic"}]}',
@@ -155,6 +157,7 @@ def main():
155
  768,
156
  896,
157
  6,
 
158
  ],
159
  [
160
  '{"ops":[{"insert":"a "},{"attributes":{"font":"mirza"},"insert":"beautiful garden"},{"insert":" with a "},{"attributes":{"font":"roboto"},"insert":"snow mountain in the background"},{"insert":""}]}',
@@ -162,6 +165,7 @@ def main():
162
  512,
163
  512,
164
  3,
 
165
  ],
166
  [
167
  '{"ops":[{"insert":"A close-up 4k dslr photo of a "},{"attributes":{"link":"A cat wearing sunglasses and a bandana around its neck."},"insert":"cat"},{"insert":" riding a scooter. Palm trees in the background."}]}',
@@ -169,6 +173,7 @@ def main():
169
  512,
170
  512,
171
  6,
 
172
  ],
173
  [
174
  {"ops":[{"insert":"a "},{"attributes":{"font":"slabo"},"insert":"night sky filled with stars"},{"insert":" above a "},{"attributes":{"font":"roboto"},"insert":"turbulent sea with giant waves"},{"insert":"\n"}]},
@@ -176,6 +181,7 @@ def main():
176
  512,
177
  512,
178
  6,
 
179
  ],
180
  [
181
  {"ops":[{"attributes":{"link":"the awe-inspiring sky and ocean in the style of J.M.W. Turner"},"insert":"the awe-inspiring sky and sea"},{"insert":" by "},{"attributes":{"font":"mirza"},"insert":"a coast with flowers and grasses in spring"},{"insert":"\n"}]},
@@ -183,6 +189,7 @@ def main():
183
  512,
184
  512,
185
  9,
 
186
  ],
187
  ]
188
  gr.Examples(examples=examples,
@@ -192,6 +199,7 @@ def main():
192
  height,
193
  width,
194
  seed,
 
195
  ],
196
  outputs=[
197
  result,
@@ -211,6 +219,7 @@ def main():
211
  seed,
212
  steps,
213
  guidance_weight,
 
214
  ],
215
  outputs=[result, token_map],
216
  )
 
35
  seed: int,
36
  steps: int,
37
  guidance_weight: float,
38
+ color_guidance_weight: float,
39
  ):
40
  run_dir = 'results/'
41
  # Load region diffusion model.
 
58
 
59
  # create control input for region guidance
60
  text_format_dict, color_target_token_ids = get_gradient_guidance_input(
61
+ model, base_tokens, color_text_prompts, color_rgbs, text_format_dict, color_guidance_weight=color_guidance_weight)
62
 
63
  seed_everything(seed)
64
 
 
149
  512,
150
  512,
151
  6,
152
+ 1,
153
  ],
154
  [
155
  '{"ops": [{"insert": "A pizza with "}, {"attributes": {"size": "50px"}, "insert": "pineapples"}, {"insert": ", pepperonis, and mushrooms on the top, 4k, photorealistic"}]}',
 
157
  768,
158
  896,
159
  6,
160
+ 1,
161
  ],
162
  [
163
  '{"ops":[{"insert":"a "},{"attributes":{"font":"mirza"},"insert":"beautiful garden"},{"insert":" with a "},{"attributes":{"font":"roboto"},"insert":"snow mountain in the background"},{"insert":""}]}',
 
165
  512,
166
  512,
167
  3,
168
+ 1,
169
  ],
170
  [
171
  '{"ops":[{"insert":"A close-up 4k dslr photo of a "},{"attributes":{"link":"A cat wearing sunglasses and a bandana around its neck."},"insert":"cat"},{"insert":" riding a scooter. Palm trees in the background."}]}',
 
173
  512,
174
  512,
175
  6,
176
+ 1,
177
  ],
178
  [
179
  {"ops":[{"insert":"a "},{"attributes":{"font":"slabo"},"insert":"night sky filled with stars"},{"insert":" above a "},{"attributes":{"font":"roboto"},"insert":"turbulent sea with giant waves"},{"insert":"\n"}]},
 
181
  512,
182
  512,
183
  6,
184
+ 1,
185
  ],
186
  [
187
  {"ops":[{"attributes":{"link":"the awe-inspiring sky and ocean in the style of J.M.W. Turner"},"insert":"the awe-inspiring sky and sea"},{"insert":" by "},{"attributes":{"font":"mirza"},"insert":"a coast with flowers and grasses in spring"},{"insert":"\n"}]},
 
189
  512,
190
  512,
191
  9,
192
+ 1,
193
  ],
194
  ]
195
  gr.Examples(examples=examples,
 
199
  height,
200
  width,
201
  seed,
202
+ color_guidance_weight,
203
  ],
204
  outputs=[
205
  result,
 
219
  seed,
220
  steps,
221
  guidance_weight,
222
+ color_guidance_weight,
223
  ],
224
  outputs=[result, token_map],
225
  )