Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -277,17 +277,19 @@ css = """
|
|
| 277 |
"""
|
| 278 |
example = """
|
| 279 |
Emotion Description
|
|
|
|
| 280 |
a photo of a person feeling joyful
|
|
|
|
| 281 |
a photo of a person feeling sorrowful
|
|
|
|
| 282 |
a photo of a person feeling enraged
|
|
|
|
| 283 |
a photo of a person feeling astonished
|
|
|
|
| 284 |
a photo of a person feeling disgusted
|
|
|
|
| 285 |
a photo of a person feeling terrified
|
| 286 |
-
|
| 287 |
-
a photo of a person feeling nervous
|
| 288 |
-
a photo of a person feeling tranquil
|
| 289 |
-
a photo of a person feeling perplexed
|
| 290 |
-
a photo of a person feeling resolute
|
| 291 |
...
|
| 292 |
|
| 293 |
"""
|
|
@@ -296,6 +298,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 296 |
### compose new images with visual concepts
|
| 297 |
following the algorithm proposed in [*IP-Composer: Semantic Composition of Visual Concepts* by Dorfman et al.](https://arxiv.org/pdf/2502.13951)
|
| 298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
[[project page](https://ip-composer.github.io/IP-Composer/)] [[arxiv](https://arxiv.org/pdf/2502.13951)]
|
| 300 |
""")
|
| 301 |
concpet_from_file_1 = gr.State()
|
|
@@ -314,30 +320,30 @@ following the algorithm proposed in [*IP-Composer: Semantic Composition of Visua
|
|
| 314 |
with gr.Accordion("π‘ add a new concept π", open=False):
|
| 315 |
gr.Markdown("1. upload a file with text variations of your concept (e.g. ask an LLM)")
|
| 316 |
gr.Markdown("2. prefereably with > 100 variations.")
|
| 317 |
-
with gr.Accordion("file example for the concept 'emotions'"):
|
| 318 |
gr.Markdown(example)
|
| 319 |
concept_file_1 = gr.File(label="concept variations", file_types=["text"])
|
| 320 |
|
| 321 |
-
with gr.Tab("concept 2
|
| 322 |
with gr.Group():
|
| 323 |
concept_image2 = gr.Image(label="Concept Image 2", type="numpy")
|
| 324 |
concept_name2 = gr.Dropdown(concept_options, label="concept 2", value=None, info="concept type")
|
| 325 |
with gr.Accordion("π‘ add a new concept π", open=False):
|
| 326 |
gr.Markdown("1. upload a file with text variations of your concept (e.g. ask an LLM)")
|
| 327 |
gr.Markdown("2. prefereably with > 100 variations.")
|
| 328 |
-
with gr.Accordion("file example for the concept 'emotions'"):
|
| 329 |
gr.Markdown(example)
|
| 330 |
concept_file_2 = gr.File(label="concept variations", file_types=["text"])
|
| 331 |
|
| 332 |
|
| 333 |
-
with gr.Tab("concept 3
|
| 334 |
with gr.Group():
|
| 335 |
concept_image3 = gr.Image(label="Concept Image 3", type="numpy")
|
| 336 |
concept_name3 = gr.Dropdown(concept_options, label="concept 3", value= None, info="concept type")
|
| 337 |
with gr.Accordion("π‘ add a new concept π", open=False):
|
| 338 |
gr.Markdown("1. upload a file with text variations of your concept (e.g. ask an LLM)")
|
| 339 |
gr.Markdown("2. prefereably with > 100 variations.")
|
| 340 |
-
with gr.Accordion("file example for the concept 'emotions'"):
|
| 341 |
gr.Markdown(example)
|
| 342 |
concept_file_3 = gr.File(label="concept variations", file_types=["text"])
|
| 343 |
|
|
|
|
| 277 |
"""
|
| 278 |
example = """
|
| 279 |
Emotion Description
|
| 280 |
+
|
| 281 |
a photo of a person feeling joyful
|
| 282 |
+
|
| 283 |
a photo of a person feeling sorrowful
|
| 284 |
+
|
| 285 |
a photo of a person feeling enraged
|
| 286 |
+
|
| 287 |
a photo of a person feeling astonished
|
| 288 |
+
|
| 289 |
a photo of a person feeling disgusted
|
| 290 |
+
|
| 291 |
a photo of a person feeling terrified
|
| 292 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
...
|
| 294 |
|
| 295 |
"""
|
|
|
|
| 298 |
### compose new images with visual concepts
|
| 299 |
following the algorithm proposed in [*IP-Composer: Semantic Composition of Visual Concepts* by Dorfman et al.](https://arxiv.org/pdf/2502.13951)
|
| 300 |
|
| 301 |
+
#### 1. upload a base image
|
| 302 |
+
#### 2. upload 1-3 concept images
|
| 303 |
+
#### 3. select concept type to extract from each concept image
|
| 304 |
+
|
| 305 |
[[project page](https://ip-composer.github.io/IP-Composer/)] [[arxiv](https://arxiv.org/pdf/2502.13951)]
|
| 306 |
""")
|
| 307 |
concpet_from_file_1 = gr.State()
|
|
|
|
| 320 |
with gr.Accordion("π‘ add a new concept π", open=False):
|
| 321 |
gr.Markdown("1. upload a file with text variations of your concept (e.g. ask an LLM)")
|
| 322 |
gr.Markdown("2. prefereably with > 100 variations.")
|
| 323 |
+
with gr.Accordion("file example for the concept 'emotions'", open=False):
|
| 324 |
gr.Markdown(example)
|
| 325 |
concept_file_1 = gr.File(label="concept variations", file_types=["text"])
|
| 326 |
|
| 327 |
+
with gr.Tab("concept 2 (optional)"):
|
| 328 |
with gr.Group():
|
| 329 |
concept_image2 = gr.Image(label="Concept Image 2", type="numpy")
|
| 330 |
concept_name2 = gr.Dropdown(concept_options, label="concept 2", value=None, info="concept type")
|
| 331 |
with gr.Accordion("π‘ add a new concept π", open=False):
|
| 332 |
gr.Markdown("1. upload a file with text variations of your concept (e.g. ask an LLM)")
|
| 333 |
gr.Markdown("2. prefereably with > 100 variations.")
|
| 334 |
+
with gr.Accordion("file example for the concept 'emotions'", open=False):
|
| 335 |
gr.Markdown(example)
|
| 336 |
concept_file_2 = gr.File(label="concept variations", file_types=["text"])
|
| 337 |
|
| 338 |
|
| 339 |
+
with gr.Tab("concept 3 (optional)"):
|
| 340 |
with gr.Group():
|
| 341 |
concept_image3 = gr.Image(label="Concept Image 3", type="numpy")
|
| 342 |
concept_name3 = gr.Dropdown(concept_options, label="concept 3", value= None, info="concept type")
|
| 343 |
with gr.Accordion("π‘ add a new concept π", open=False):
|
| 344 |
gr.Markdown("1. upload a file with text variations of your concept (e.g. ask an LLM)")
|
| 345 |
gr.Markdown("2. prefereably with > 100 variations.")
|
| 346 |
+
with gr.Accordion("file example for the concept 'emotions'", open=False):
|
| 347 |
gr.Markdown(example)
|
| 348 |
concept_file_3 = gr.File(label="concept variations", file_types=["text"])
|
| 349 |
|