VictorSanh commited on
Commit
64bd8cb
·
1 Parent(s): 1779a57
Files changed (1) hide show
  1. app_dialogue.py +34 -32
app_dialogue.py CHANGED
@@ -331,8 +331,7 @@ textbox = gr.Textbox(
331
  container=False,
332
  label="Text input",
333
  scale=6,
334
- lines=20,
335
- max_lines=50,
336
  )
337
  with gr.Blocks(title="D", theme=gr.themes.Base()) as demo:
338
  gr.HTML("""<h1 align="center">Meme it</h1>""")
@@ -361,7 +360,7 @@ with gr.Blocks(title="D", theme=gr.themes.Base()) as demo:
361
  visible=False,
362
  )
363
 
364
- imagebox = gr.Image(type="filepath", label="Image input", visible=True)
365
 
366
  with gr.Row():
367
  # def prefetch_images_in_history(user_prompt_str):
@@ -369,35 +368,37 @@ with gr.Blocks(title="D", theme=gr.themes.Base()) as demo:
369
  # Pre-fetch the images that are passed in the chatbot default history.
370
  # """
371
  # return prompt_list_to_markdown(handle_manual_images_in_user_prompt(user_prompt_str))
372
-
373
- chatbot = gr.Chatbot(
374
- elem_id="chatbot",
375
- label="IDEFICS",
376
- visible=True,
377
- height=750,
378
- avatar_images=[None, BOT_AVATAR]
379
- # value=[
380
- # [
381
- # (
382
- # prefetch_images_in_history(
383
- # """Write a funny story including the following characters.
384
- # There should be drama and most importantly romance.
385
- # 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>
386
- # 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>
387
- # Character 3:<fake_token_around_image><image:https://upload.wikimedia.org/wikipedia/en/e/ef/Marsupilami_1.jpg><fake_token_around_image>
388
- # 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>"""
389
- # )
390
- # ),
391
- # """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.
392
- # 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.
393
- # 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.
394
- # 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.
395
- # 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.
396
- # 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.
397
- # And so, the story of Mulan and Shrek's romance came to an end, leaving a lasting impression on all who heard it.""",
398
- # ],
399
- # ],
400
- )
 
 
401
 
402
  with gr.Group():
403
  with gr.Row():
@@ -421,6 +422,7 @@ with gr.Blocks(title="D", theme=gr.themes.Base()) as demo:
421
  lines=20,
422
  max_lines=50,
423
  interactive=True,
 
424
  )
425
  max_new_tokens = gr.Slider(
426
  minimum=8,
 
331
  container=False,
332
  label="Text input",
333
  scale=6,
334
+ max_lines=5,
 
335
  )
336
  with gr.Blocks(title="D", theme=gr.themes.Base()) as demo:
337
  gr.HTML("""<h1 align="center">Meme it</h1>""")
 
360
  visible=False,
361
  )
362
 
363
+
364
 
365
  with gr.Row():
366
  # def prefetch_images_in_history(user_prompt_str):
 
368
  # Pre-fetch the images that are passed in the chatbot default history.
369
  # """
370
  # return prompt_list_to_markdown(handle_manual_images_in_user_prompt(user_prompt_str))
371
+ with gr.Column():
372
+ imagebox = gr.Image(type="filepath", label="Image input", visible=True)
373
+ with gr.Column():
374
+ chatbot = gr.Chatbot(
375
+ elem_id="chatbot",
376
+ label="IDEFICS",
377
+ visible=True,
378
+ height=750,
379
+ avatar_images=[None, BOT_AVATAR]
380
+ # value=[
381
+ # [
382
+ # (
383
+ # prefetch_images_in_history(
384
+ # """Write a funny story including the following characters.
385
+ # There should be drama and most importantly romance.
386
+ # 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>
387
+ # 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>
388
+ # Character 3:<fake_token_around_image><image:https://upload.wikimedia.org/wikipedia/en/e/ef/Marsupilami_1.jpg><fake_token_around_image>
389
+ # 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>"""
390
+ # )
391
+ # ),
392
+ # """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.
393
+ # 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.
394
+ # 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.
395
+ # 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.
396
+ # 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.
397
+ # 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.
398
+ # And so, the story of Mulan and Shrek's romance came to an end, leaving a lasting impression on all who heard it.""",
399
+ # ],
400
+ # ],
401
+ )
402
 
403
  with gr.Group():
404
  with gr.Row():
 
422
  lines=20,
423
  max_lines=50,
424
  interactive=True,
425
+ visible=False,
426
  )
427
  max_new_tokens = gr.Slider(
428
  minimum=8,