Spaces:
Runtime error
Runtime error
Commit
·
a558847
1
Parent(s):
7644d2d
Swap out the UI elements
Browse files- app_dialogue.py +17 -38
app_dialogue.py
CHANGED
|
@@ -333,6 +333,14 @@ textbox = gr.Textbox(
|
|
| 333 |
scale=6,
|
| 334 |
max_lines=5,
|
| 335 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo:
|
| 337 |
gr.HTML("""<h1 align="center">AI Dad Jokes</h1>""")
|
| 338 |
with gr.Row(variant="panel"):
|
|
@@ -357,48 +365,19 @@ with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo:
|
|
| 357 |
visible=False,
|
| 358 |
)
|
| 359 |
|
| 360 |
-
|
| 361 |
-
|
| 362 |
with gr.Row():
|
| 363 |
with gr.Column():
|
| 364 |
imagebox = gr.Image(type="filepath", label="Image input", visible=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
with gr.Column():
|
| 366 |
-
chatbot
|
| 367 |
-
elem_id="chatbot",
|
| 368 |
-
label="IDEFICS",
|
| 369 |
-
visible=True,
|
| 370 |
-
height=750,
|
| 371 |
-
avatar_images=[None, BOT_AVATAR]
|
| 372 |
-
# value=[
|
| 373 |
-
# [
|
| 374 |
-
# (
|
| 375 |
-
# prefetch_images_in_history(
|
| 376 |
-
# """Write a funny story including the following characters.
|
| 377 |
-
# There should be drama and most importantly romance.
|
| 378 |
-
# Character 1:<fake_token_around_image><image:https://m.media-amazon.com/images/M/MV5BODg1OTczMWEtNTU3MS00OTUzLThjODEtNDg1MWQwZmExYmFlXkEyXkFqcGdeQWFybm8@._V1_QL75_UX500_CR0,0,500,281_.jpg><fake_token_around_image>
|
| 379 |
-
# Character 2:<fake_token_around_image><image:https://static.wikia.nocookie.net/dreamworks/images/0/09/Shrek_dreamworks.png/revision/latest?cb=20170921225439><fake_token_around_image>
|
| 380 |
-
# Character 3:<fake_token_around_image><image:https://upload.wikimedia.org/wikipedia/en/e/ef/Marsupilami_1.jpg><fake_token_around_image>
|
| 381 |
-
# The plot should take place in the world pictured here:<fake_token_around_image><image:https://www.astronomy.com/wp-content/uploads/sites/2/2021/09/ON1.jpg><fake_token_around_image>"""
|
| 382 |
-
# )
|
| 383 |
-
# ),
|
| 384 |
-
# """Once upon a time, in a world where the sky was a dome and the ground was covered in grass, there lived a beautiful princess named Mulan. She was kind, brave, and always ready to help others. One day, while walking through the forest, she stumbled upon a strange creature. It was a green ogre named Shrek, who was lost and looking for his way back home.
|
| 385 |
-
# Mulan, being the kind-hearted person she was, decided to help Shrek find his way back. As they traveled together, they began to develop a strong bond. Shrek was impressed by Mulan's bravery and determination, while Mulan admired Shrek's loyalty and sense of humor.
|
| 386 |
-
# However, their journey was not without obstacles. They encountered a mischievous cat named Hoboua, who was always causing trouble and getting into fights. Despite his troublemaking ways, Hoboua had a good heart and eventually became a valuable ally to Mulan and Shrek.
|
| 387 |
-
# As they traveled, they faced many challenges, including battling fierce dragons and navigating treacherous mountains. Through it all, Mulan and Shrek grew closer, and their feelings for each other deepened.
|
| 388 |
-
# Finally, they reached Shrek's home, and he was reunited with his family and friends. Mulan, however, was sad to leave him behind. But Shrek had a surprise for her. He had fallen in love with her and wanted to be with her forever.
|
| 389 |
-
# Mulan was overjoyed, and they shared a passionate kiss. From that day on, they lived happily ever after, exploring the world together and facing any challenges that came their way.
|
| 390 |
-
# And so, the story of Mulan and Shrek's romance came to an end, leaving a lasting impression on all who heard it.""",
|
| 391 |
-
# ],
|
| 392 |
-
# ],
|
| 393 |
-
)
|
| 394 |
-
|
| 395 |
-
with gr.Group():
|
| 396 |
-
with gr.Row():
|
| 397 |
-
textbox.render()
|
| 398 |
-
submit_btn = gr.Button(value="▶️ Submit", visible=True)
|
| 399 |
-
clear_btn = gr.ClearButton([textbox, imagebox, chatbot], value="🧹 Clear")
|
| 400 |
-
regenerate_btn = gr.Button(value="🔄 Regenerate", visible=True)
|
| 401 |
-
upload_btn = gr.UploadButton("📁 Upload image", file_types=["image"])
|
| 402 |
|
| 403 |
with gr.Row():
|
| 404 |
with gr.Accordion("Advanced settings", open=False, visible=True) as parameter_row:
|
|
|
|
| 333 |
scale=6,
|
| 334 |
max_lines=5,
|
| 335 |
)
|
| 336 |
+
chatbot = gr.Chatbot(
|
| 337 |
+
elem_id="chatbot",
|
| 338 |
+
label="IDEFICS",
|
| 339 |
+
visible=True,
|
| 340 |
+
height=750,
|
| 341 |
+
avatar_images=[None, BOT_AVATAR]
|
| 342 |
+
)
|
| 343 |
+
|
| 344 |
with gr.Blocks(title="AI Dad Jokes", theme=gr.themes.Base()) as demo:
|
| 345 |
gr.HTML("""<h1 align="center">AI Dad Jokes</h1>""")
|
| 346 |
with gr.Row(variant="panel"):
|
|
|
|
| 365 |
visible=False,
|
| 366 |
)
|
| 367 |
|
|
|
|
|
|
|
| 368 |
with gr.Row():
|
| 369 |
with gr.Column():
|
| 370 |
imagebox = gr.Image(type="filepath", label="Image input", visible=True)
|
| 371 |
+
with gr.Group():
|
| 372 |
+
with gr.Row():
|
| 373 |
+
textbox.render()
|
| 374 |
+
submit_btn = gr.Button(value="▶️ Submit", visible=True)
|
| 375 |
+
with gr.Row():
|
| 376 |
+
clear_btn = gr.ClearButton([textbox, imagebox, chatbot], value="🧹 Clear")
|
| 377 |
+
regenerate_btn = gr.Button(value="🔄 Regenerate", visible=True)
|
| 378 |
+
upload_btn = gr.UploadButton("📁 Upload image", file_types=["image"],visible=False)
|
| 379 |
with gr.Column():
|
| 380 |
+
chatbot.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
|
| 382 |
with gr.Row():
|
| 383 |
with gr.Accordion("Advanced settings", open=False, visible=True) as parameter_row:
|