Spaces:
Running
on
Zero
Running
on
Zero
add examples
Browse files
app.py
CHANGED
@@ -69,6 +69,27 @@ RANKS_MAP={
|
|
69 |
concept_options = list(CONCEPTS_MAP.keys())
|
70 |
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
MAX_SEED = np.iinfo(np.int32).max
|
73 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
74 |
if randomize_seed:
|
@@ -248,6 +269,18 @@ following the algorithm proposed in [*IP-Composer: Semantic Composition of Visua
|
|
248 |
output_image = gr.Image(label="composed output", show_label=True)
|
249 |
submit_btn = gr.Button("Generate")
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
submit_btn.click(
|
253 |
fn=randomize_seed_fn,
|
|
|
69 |
concept_options = list(CONCEPTS_MAP.keys())
|
70 |
|
71 |
|
72 |
+
examples = [
|
73 |
+
['./IP_Composer/assets/objects/mug.png', './IP_Composer/assets/patterns/splash.png', 'patterns (including color)', None, None, None, None, 80, 30, 30, None,1.0,0]
|
74 |
+
|
75 |
+
]
|
76 |
+
|
77 |
+
def generate_examples(base_image,
|
78 |
+
concept_image1, concept_name1,
|
79 |
+
concept_image2, concept_name2,
|
80 |
+
concept_image3, concept_name3,
|
81 |
+
rank1, rank2, rank3,
|
82 |
+
prompt, scale, seed):
|
83 |
+
return process_and_display(base_image,
|
84 |
+
concept_image1, concept_name1,
|
85 |
+
concept_image2, concept_name2,
|
86 |
+
concept_image3, concept_name3,
|
87 |
+
rank1, rank2, rank3,
|
88 |
+
prompt, scale, seed)
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
MAX_SEED = np.iinfo(np.int32).max
|
94 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
95 |
if randomize_seed:
|
|
|
269 |
output_image = gr.Image(label="composed output", show_label=True)
|
270 |
submit_btn = gr.Button("Generate")
|
271 |
|
272 |
+
gr.Examples(
|
273 |
+
examples,
|
274 |
+
inputs=[base_image,
|
275 |
+
concept_image1, concept_name1,
|
276 |
+
concept_image2, concept_name2,
|
277 |
+
concept_image3, concept_name3,
|
278 |
+
rank1, rank2, rank3,
|
279 |
+
prompt, scale, seed],
|
280 |
+
outputs=[output_image],
|
281 |
+
fn=generate_examples,
|
282 |
+
cache_examples=False
|
283 |
+
)
|
284 |
|
285 |
submit_btn.click(
|
286 |
fn=randomize_seed_fn,
|