Update src/app.py
Browse files- src/app.py +32 -15
src/app.py
CHANGED
@@ -148,7 +148,18 @@ def process_images(annotated_image, second_image, user_api_key=None, progress=gr
|
|
148 |
|
149 |
|
150 |
# Create the Gradio interface
|
151 |
-
with gr.Blocks(theme='
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
gr.HTML(
|
153 |
"""
|
154 |
<h1><center>Guide Your Nano Banana👉🍌</center></h1>
|
@@ -229,20 +240,7 @@ with gr.Blocks(theme='monochrome') as demo:
|
|
229 |
placeholder="Results will appear here...",
|
230 |
lines=3,
|
231 |
)
|
232 |
-
|
233 |
-
# Examples section
|
234 |
-
with gr.Accordion("ℹ️ Tips for Best Results", open=False):
|
235 |
-
gr.Markdown(
|
236 |
-
"""
|
237 |
-
- **Box Placement**: Draw the box exactly where you want the object to appear
|
238 |
-
- **Image Quality**: Use high-resolution images for better results
|
239 |
-
- **Object Selection**: The second image should clearly show the object you want to insert
|
240 |
-
- **Lighting**: Images with similar lighting conditions work best
|
241 |
-
- **Processing Time**: Generation typically takes 10-30 seconds
|
242 |
-
- **API Key**: If you encounter errors, try using your own FAL API key
|
243 |
-
"""
|
244 |
-
)
|
245 |
-
|
246 |
# Connect the button to the processing function
|
247 |
generate_btn.click(
|
248 |
fn=process_images,
|
@@ -251,5 +249,24 @@ with gr.Blocks(theme='monochrome') as demo:
|
|
251 |
show_progress=True,
|
252 |
)
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
if __name__ == "__main__":
|
255 |
demo.launch(ssr_mode=False)
|
|
|
148 |
|
149 |
|
150 |
# Create the Gradio interface
|
151 |
+
with gr.Blocks(theme='ocean') as demo:
|
152 |
+
# Add navigation bar
|
153 |
+
navbar = gr.Navbar(
|
154 |
+
value=[
|
155 |
+
("Documentation", "https://docs.fal.ai"),
|
156 |
+
("FAL.AI nano-banana", "https://fal.ai/models/fal-ai/nano-banana/edit/api"),
|
157 |
+
("Learn more about Gradio Navbar", "https://www.gradio.app/guides/multipage-apps#customizing-the-navbar")
|
158 |
+
],
|
159 |
+
visible=True,
|
160 |
+
main_page_name="🎨 guided nano banana"
|
161 |
+
)
|
162 |
+
|
163 |
gr.HTML(
|
164 |
"""
|
165 |
<h1><center>Guide Your Nano Banana👉🍌</center></h1>
|
|
|
240 |
placeholder="Results will appear here...",
|
241 |
lines=3,
|
242 |
)
|
243 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
# Connect the button to the processing function
|
245 |
generate_btn.click(
|
246 |
fn=process_images,
|
|
|
249 |
show_progress=True,
|
250 |
)
|
251 |
|
252 |
+
with demo.route("Tips", "/tips"):
|
253 |
+
gr.Markdown(
|
254 |
+
"""
|
255 |
+
# ℹ️ Tips for Best Results
|
256 |
+
- **Box Placement**: Draw the box exactly where you want the object to appear
|
257 |
+
- **Image Quality**: Use high-resolution images for better results
|
258 |
+
- **Object Selection**: The second image should clearly show the object you want to insert
|
259 |
+
- **Lighting**: Images with similar lighting conditions work best
|
260 |
+
- **Processing Time**: Generation typically takes 10-30 seconds
|
261 |
+
- **API Key**: If you encounter errors, try using your own FAL API key
|
262 |
+
"""
|
263 |
+
)
|
264 |
+
|
265 |
+
# Different navbar for the Settings page
|
266 |
+
navbar = gr.Navbar(
|
267 |
+
visible=True,
|
268 |
+
main_page_name="Home",
|
269 |
+
)
|
270 |
+
|
271 |
if __name__ == "__main__":
|
272 |
demo.launch(ssr_mode=False)
|