Spaces:
Runtime error
Runtime error
Added duplicate space link
Browse files
app.py
CHANGED
|
@@ -18,7 +18,6 @@ MIN_SIZE = 0.01
|
|
| 18 |
WHITE = 255
|
| 19 |
COLORS = ["red", "blue", "green", "orange", "purple", "turquoise", "olive"]
|
| 20 |
|
| 21 |
-
|
| 22 |
PROMPT1 = "3D Pixar animation of a cute unicorn and a pink hedgehog and a nerdy owl traveling in a magical forest"
|
| 23 |
PROMPT2 = "science fiction movie poster with an astronaut and a robot and a green alien and a spaceship"
|
| 24 |
PROMPT3 = "a golden retriever and a german shepherd and a boston terrier and an english bulldog and a border collie in a pool"
|
|
@@ -43,6 +42,27 @@ EXAMPLE_BOXES = {
|
|
| 43 |
],
|
| 44 |
}
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
def inference(
|
| 48 |
boxes,
|
|
@@ -260,17 +280,9 @@ def main():
|
|
| 260 |
css=css,
|
| 261 |
title="Bounded Attention demo",
|
| 262 |
) as demo:
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
<span style="font-size: 18px" id="paper-info">
|
| 267 |
-
[<a href="https://omer11a.github.io/bounded-attention/" target="_blank">Project Page</a>]
|
| 268 |
-
[<a href="https://arxiv.org/abs/2403.16990" target="_blank">Paper</a>]
|
| 269 |
-
[<a href="https://github.com/omer11a/bounded-attention" target="_blank">GitHub</a>]
|
| 270 |
-
</span>
|
| 271 |
-
</p>
|
| 272 |
-
"""
|
| 273 |
-
gr.HTML(description)
|
| 274 |
with gr.Column():
|
| 275 |
prompt = gr.Textbox(
|
| 276 |
label="Text prompt",
|
|
@@ -409,10 +421,9 @@ def main():
|
|
| 409 |
seed,
|
| 410 |
],
|
| 411 |
outputs=[boxes, sketchpad, layout_image, out_images],
|
| 412 |
-
cache_examples=True,
|
| 413 |
)
|
| 414 |
-
|
| 415 |
-
gr.HTML(
|
| 416 |
|
| 417 |
demo.launch(show_api=False, show_error=True)
|
| 418 |
|
|
|
|
| 18 |
WHITE = 255
|
| 19 |
COLORS = ["red", "blue", "green", "orange", "purple", "turquoise", "olive"]
|
| 20 |
|
|
|
|
| 21 |
PROMPT1 = "3D Pixar animation of a cute unicorn and a pink hedgehog and a nerdy owl traveling in a magical forest"
|
| 22 |
PROMPT2 = "science fiction movie poster with an astronaut and a robot and a green alien and a spaceship"
|
| 23 |
PROMPT3 = "a golden retriever and a german shepherd and a boston terrier and an english bulldog and a border collie in a pool"
|
|
|
|
| 42 |
],
|
| 43 |
}
|
| 44 |
|
| 45 |
+
DESCRIPTION = """
|
| 46 |
+
<p style="text-align: center; font-weight: bold;">
|
| 47 |
+
<span style="font-size: 28px">Bounded Attention</span>
|
| 48 |
+
<br>
|
| 49 |
+
<span style="font-size: 18px" id="paper-info">
|
| 50 |
+
[<a href="https://omer11a.github.io/bounded-attention/" target="_blank">Project Page</a>]
|
| 51 |
+
[<a href="https://arxiv.org/abs/2403.16990" target="_blank">Paper</a>]
|
| 52 |
+
[<a href="https://github.com/omer11a/bounded-attention" target="_blank">GitHub</a>]
|
| 53 |
+
</span>
|
| 54 |
+
</p>
|
| 55 |
+
"""
|
| 56 |
+
COPY_LINK = """
|
| 57 |
+
<a href="https://huggingface.co/spaces/omer11a/bounded-attention?duplicate=true">
|
| 58 |
+
<img src="https://bit.ly/3gLdBN6" alt="Duplicate Space">
|
| 59 |
+
</a>
|
| 60 |
+
Duplicate this space to generate more samples without waiting in queue
|
| 61 |
+
"""
|
| 62 |
+
FOOTNOTE = """
|
| 63 |
+
<p>The source code of this demo is based on the <a href="https://huggingface.co/spaces/gligen/demo/tree/main">GLIGEN demo</a>.</p>
|
| 64 |
+
"""
|
| 65 |
+
|
| 66 |
|
| 67 |
def inference(
|
| 68 |
boxes,
|
|
|
|
| 280 |
css=css,
|
| 281 |
title="Bounded Attention demo",
|
| 282 |
) as demo:
|
| 283 |
+
gr.HTML(DESCRIPTION)
|
| 284 |
+
gr.HTML(COPY_LINK)
|
| 285 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
with gr.Column():
|
| 287 |
prompt = gr.Textbox(
|
| 288 |
label="Text prompt",
|
|
|
|
| 421 |
seed,
|
| 422 |
],
|
| 423 |
outputs=[boxes, sketchpad, layout_image, out_images],
|
|
|
|
| 424 |
)
|
| 425 |
+
|
| 426 |
+
gr.HTML(FOOTNOTE)
|
| 427 |
|
| 428 |
demo.launch(show_api=False, show_error=True)
|
| 429 |
|