Update app.py
Browse files
app.py
CHANGED
|
@@ -520,7 +520,7 @@ examples_image_banner=gr.HTML(
|
|
| 520 |
</style>
|
| 521 |
|
| 522 |
<div class="animation-container">
|
| 523 |
-
<div class="animation-title">
|
| 524 |
<div class="mini-container" id="animContainer">
|
| 525 |
<!-- Set 1 Images -->
|
| 526 |
<div class="mini-image-wrapper mini-left-image set1" style="animation-play-state: running;">
|
|
@@ -579,7 +579,6 @@ with gr.Blocks(theme='ocean') as demo:
|
|
| 579 |
# Add navigation bar
|
| 580 |
navbar = gr.Navbar(
|
| 581 |
value=[
|
| 582 |
-
("Documentation", "https://docs.fal.ai"),
|
| 583 |
("FAL.AI nano-banana", "https://fal.ai/models/fal-ai/nano-banana/edit/api"),
|
| 584 |
("Learn more about Gradio Navbar", "https://www.gradio.app/guides/multipage-apps#customizing-the-navbar")
|
| 585 |
],
|
|
@@ -601,13 +600,11 @@ with gr.Blocks(theme='ocean') as demo:
|
|
| 601 |
3. Click "Generate Composite Image" and wait for the Gradio and Nano-Banana to blend the images<br>
|
| 602 |
|
| 603 |
The Gradio app will intelligently place the object from the second image into the boxed area of the first image,
|
| 604 |
-
taking care of lighting, shadows, and proper integration.
|
| 605 |
"""
|
| 606 |
)
|
| 607 |
|
| 608 |
-
|
| 609 |
-
#with gr.Row():
|
| 610 |
-
#with gr.Column():
|
| 611 |
with gr.Accordion("🔑 API Configuration (Optional)", open=False):
|
| 612 |
gr.Markdown(
|
| 613 |
"""
|
|
@@ -629,7 +626,7 @@ with gr.Blocks(theme='ocean') as demo:
|
|
| 629 |
with gr.Column(scale=1):
|
| 630 |
with gr.Row():
|
| 631 |
with gr.Column(scale=1):
|
| 632 |
-
gr.Markdown("### Step 1: Annotate First Image")
|
| 633 |
# Image annotator for first image
|
| 634 |
from gradio_image_annotation import image_annotator
|
| 635 |
#first_image = ImageAnnotator(
|
|
@@ -683,24 +680,24 @@ with gr.Blocks(theme='ocean') as demo:
|
|
| 683 |
examples = [
|
| 684 |
[
|
| 685 |
{
|
| 686 |
-
"image": "example1-1.png",
|
| 687 |
"boxes": [{"xmin": 61, "ymin": 298, "xmax": 228, "ymax": 462}],
|
| 688 |
},
|
| 689 |
-
"example1-2.png",
|
| 690 |
],
|
| 691 |
[
|
| 692 |
{
|
| 693 |
-
"image": "example2-1.png",
|
| 694 |
"boxes": [{"xmin": 205, "ymin": 791, "xmax": 813, "ymax": 1161}],
|
| 695 |
},
|
| 696 |
-
"example2-2.jpg",
|
| 697 |
],
|
| 698 |
[
|
| 699 |
{
|
| 700 |
-
"image": "example3-1.png",
|
| 701 |
"boxes": [{"xmin": 24, "ymin": 465, "xmax": 146, "ymax": 607}],
|
| 702 |
},
|
| 703 |
-
"example3-2.png",
|
| 704 |
],
|
| 705 |
]
|
| 706 |
|
|
@@ -710,7 +707,7 @@ with gr.Blocks(theme='ocean') as demo:
|
|
| 710 |
)
|
| 711 |
|
| 712 |
|
| 713 |
-
with demo.route("Tips", "/tips"):
|
| 714 |
gr.Markdown(
|
| 715 |
"""
|
| 716 |
# ℹ️ Tips for Best Results
|
|
|
|
| 520 |
</style>
|
| 521 |
|
| 522 |
<div class="animation-container">
|
| 523 |
+
<div class="animation-title">Nano Banana Magic ✨</div>
|
| 524 |
<div class="mini-container" id="animContainer">
|
| 525 |
<!-- Set 1 Images -->
|
| 526 |
<div class="mini-image-wrapper mini-left-image set1" style="animation-play-state: running;">
|
|
|
|
| 579 |
# Add navigation bar
|
| 580 |
navbar = gr.Navbar(
|
| 581 |
value=[
|
|
|
|
| 582 |
("FAL.AI nano-banana", "https://fal.ai/models/fal-ai/nano-banana/edit/api"),
|
| 583 |
("Learn more about Gradio Navbar", "https://www.gradio.app/guides/multipage-apps#customizing-the-navbar")
|
| 584 |
],
|
|
|
|
| 600 |
3. Click "Generate Composite Image" and wait for the Gradio and Nano-Banana to blend the images<br>
|
| 601 |
|
| 602 |
The Gradio app will intelligently place the object from the second image into the boxed area of the first image,
|
| 603 |
+
taking care of lighting, shadows, and proper integration. Kindly note that this app is experimental, so image edits might not always create the desired results. You can create a duplicate of the app and experiment with the prompt available <a href="https://huggingface.co/spaces/ysharma/guided-placement-nano-banana/blob/main/app.py#L34">here</a> to achieve better results.
|
| 604 |
"""
|
| 605 |
)
|
| 606 |
|
| 607 |
+
# API Key input section
|
|
|
|
|
|
|
| 608 |
with gr.Accordion("🔑 API Configuration (Optional)", open=False):
|
| 609 |
gr.Markdown(
|
| 610 |
"""
|
|
|
|
| 626 |
with gr.Column(scale=1):
|
| 627 |
with gr.Row():
|
| 628 |
with gr.Column(scale=1):
|
| 629 |
+
gr.Markdown("### Step 1: Annotate First Image ()")
|
| 630 |
# Image annotator for first image
|
| 631 |
from gradio_image_annotation import image_annotator
|
| 632 |
#first_image = ImageAnnotator(
|
|
|
|
| 680 |
examples = [
|
| 681 |
[
|
| 682 |
{
|
| 683 |
+
"image": "/examples/example1-1.png",
|
| 684 |
"boxes": [{"xmin": 61, "ymin": 298, "xmax": 228, "ymax": 462}],
|
| 685 |
},
|
| 686 |
+
"/examples/example1-2.png",
|
| 687 |
],
|
| 688 |
[
|
| 689 |
{
|
| 690 |
+
"image": "/examples/example2-1.png",
|
| 691 |
"boxes": [{"xmin": 205, "ymin": 791, "xmax": 813, "ymax": 1161}],
|
| 692 |
},
|
| 693 |
+
"/examples/example2-2.jpg",
|
| 694 |
],
|
| 695 |
[
|
| 696 |
{
|
| 697 |
+
"image": "/examples/example3-1.png",
|
| 698 |
"boxes": [{"xmin": 24, "ymin": 465, "xmax": 146, "ymax": 607}],
|
| 699 |
},
|
| 700 |
+
"/examples/example3-2.png",
|
| 701 |
],
|
| 702 |
]
|
| 703 |
|
|
|
|
| 707 |
)
|
| 708 |
|
| 709 |
|
| 710 |
+
with demo.route("ℹ️Tips for Best Results", "/tips"):
|
| 711 |
gr.Markdown(
|
| 712 |
"""
|
| 713 |
# ℹ️ Tips for Best Results
|