Haozhangcx commited on
Commit
9fb5a36
โ€ข
1 Parent(s): 242da8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -36
app.py CHANGED
@@ -198,6 +198,7 @@ txt = gr.Textbox(
198
  container=False,
199
  )
200
  with gr.Blocks() as demo:
 
201
  # Informations
202
  title_markdown = ("""
203
  # LLaVA-NeXT Interleave
@@ -219,46 +220,46 @@ with gr.Blocks() as demo:
219
  ]
220
  cur_dir = os.path.dirname(os.path.abspath(__file__))
221
  gr.Markdown(title_markdown)
222
-
223
- chatbot = gr.Chatbot(
224
- [],
225
- elem_id="chatbot",
226
- bubble_full_width=False
227
- )
228
- chat_input = gr.MultimodalTextbox(interactive=True, file_types=["image","video"], placeholder="Enter message or upload file...", show_label=False)
229
-
 
 
 
 
 
 
 
 
 
230
 
231
-
232
- with gr.Row():
233
- upvote_btn = gr.Button(value="๐Ÿ‘ Upvote", interactive=True)
234
- downvote_btn = gr.Button(value="๐Ÿ‘Ž Downvote", interactive=True)
235
- flag_btn = gr.Button(value="โš ๏ธ Flag", interactive=True)
236
- #stop_btn = gr.Button(value="โน๏ธ Stop Generation", interactive=True)
237
- regenerate_btn = gr.Button(value="๐Ÿ”„ Regenerate", interactive=True)
238
- clear_btn = gr.Button(value="๐Ÿ—‘๏ธ Clear history", interactive=True)
239
- chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
240
- bot_msg = chat_msg.then(bot, chatbot, chatbot, api_name="bot_response")
241
- bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
242
-
243
- chatbot.like(print_like_dislike, None, None)
244
- clear_btn.click(fn=clear_history, inputs=[chatbot], outputs=[chatbot], api_name="clear_all")
245
- # with gr.Column():
246
- with gr.Row():
247
- gr.Examples(examples=[
248
- [{"files": [f"{cur_dir}/examples/code1.jpeg",f"{cur_dir}/examples/code2.jpeg"], "text": "Please pay attention to the movement of the object from the first image to the second image, then write a HTML code to show this movement."}],
249
- [{"files": [f"{cur_dir}/examples/shub.jpg",f"{cur_dir}/examples/shuc.jpg",f"{cur_dir}/examples/shud.jpg"], "text": "what is fun about the images?"}],
250
- [{"files": [f"{cur_dir}/examples/iphone-15-price-1024x576.jpg",f"{cur_dir}/examples/dynamic-island-1024x576.jpg",f"{cur_dir}/examples/iphone-15-colors-1024x576.jpg",f"{cur_dir}/examples/Iphone-15-Usb-c-charger-1024x576.jpg",f"{cur_dir}/examples/A-17-processors-1024x576.jpg"], "text": "The images are the PPT of iPhone 15 review. can you summarize the main information?"}],
251
- [{"files": [f"{cur_dir}/examples/fangao3.jpeg",f"{cur_dir}/examples/fangao2.jpeg",f"{cur_dir}/examples/fangao1.jpeg"], "text": "Do you kown who draw these paintings?"}],
252
- [{"files": [f"{cur_dir}/examples/oprah-winfrey-resume.png",f"{cur_dir}/examples/steve-jobs-resume.jpg"], "text": "Hi, there are two candidates, can you provide a brief description for each of them for me?"}],
253
- [{"files": [f"{cur_dir}/examples/original_bench.jpeg",f"{cur_dir}/examples/changed_bench.jpeg"], "text": "How to edit image1 to make it look like image2?"}],
254
- [{"files": [f"{cur_dir}/examples/twitter2.jpeg",f"{cur_dir}/examples/twitter3.jpeg",f"{cur_dir}/examples/twitter4.jpeg"], "text": "Please write a twitter blog post with the images."}],
255
- # [{"files": [f"{cur_dir}/examples/twitter3.jpeg",f"{cur_dir}/examples/twitter4.jpeg"], "text": "Please write a twitter blog post with the images."}],
256
- # [{"files": [f"playground/demo/examples/lion1_.mp4",f"playground/demo/examples/lion2_.mp4"], "text": "The input contains two videos, the first half is the first video and the second half is the second video. What is the difference between the two videos?"}],
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
 
 
 
 
259
 
260
-
261
- ], inputs=[chat_input], label="Compare images: ",examples_per_page=3)
262
 
263
  demo.queue()
264
  if __name__ == "__main__":
 
198
  container=False,
199
  )
200
  with gr.Blocks() as demo:
201
+
202
  # Informations
203
  title_markdown = ("""
204
  # LLaVA-NeXT Interleave
 
220
  ]
221
  cur_dir = os.path.dirname(os.path.abspath(__file__))
222
  gr.Markdown(title_markdown)
223
+ with gr.Column():
224
+ chatbot = gr.Chatbot(
225
+ [],
226
+ elem_id="chatbot",
227
+ bubble_full_width=False
228
+ )
229
+ with gr.Column():
230
+ with gr.Row():
231
+ upvote_btn = gr.Button(value="๐Ÿ‘ Upvote", interactive=True)
232
+ downvote_btn = gr.Button(value="๐Ÿ‘Ž Downvote", interactive=True)
233
+ flag_btn = gr.Button(value="โš ๏ธ Flag", interactive=True)
234
+ #stop_btn = gr.Button(value="โน๏ธ Stop Generation", interactive=True)
235
+ regenerate_btn = gr.Button(value="๐Ÿ”„ Regenerate", interactive=True)
236
+ clear_btn = gr.Button(value="๐Ÿ—‘๏ธ Clear history", interactive=True)
237
+ chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
238
+ bot_msg = chat_msg.then(bot, chatbot, chatbot, api_name="bot_response")
239
+ bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
240
 
241
+ chatbot.like(print_like_dislike, None, None)
242
+ clear_btn.click(fn=clear_history, inputs=[chatbot], outputs=[chatbot], api_name="clear_all")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
244
+ with gr.Row():
245
+ chat_input = gr.MultimodalTextbox(interactive=True, file_types=["image","video"], placeholder="Enter message or upload file...", show_label=False)
246
+ gr.Examples(examples=[
247
+ [{"files": [f"{cur_dir}/examples/code1.jpeg",f"{cur_dir}/examples/code2.jpeg"], "text": "Please pay attention to the movement of the object from the first image to the second image, then write a HTML code to show this movement."}],
248
+ [{"files": [f"{cur_dir}/examples/shub.jpg",f"{cur_dir}/examples/shuc.jpg",f"{cur_dir}/examples/shud.jpg"], "text": "what is fun about the images?"}],
249
+ [{"files": [f"{cur_dir}/examples/iphone-15-price-1024x576.jpg",f"{cur_dir}/examples/dynamic-island-1024x576.jpg",f"{cur_dir}/examples/iphone-15-colors-1024x576.jpg",f"{cur_dir}/examples/Iphone-15-Usb-c-charger-1024x576.jpg",f"{cur_dir}/examples/A-17-processors-1024x576.jpg"], "text": "The images are the PPT of iPhone 15 review. can you summarize the main information?"}],
250
+ [{"files": [f"{cur_dir}/examples/fangao3.jpeg",f"{cur_dir}/examples/fangao2.jpeg",f"{cur_dir}/examples/fangao1.jpeg"], "text": "Do you kown who draw these paintings?"}],
251
+ [{"files": [f"{cur_dir}/examples/oprah-winfrey-resume.png",f"{cur_dir}/examples/steve-jobs-resume.jpg"], "text": "Hi, there are two candidates, can you provide a brief description for each of them for me?"}],
252
+ [{"files": [f"{cur_dir}/examples/original_bench.jpeg",f"{cur_dir}/examples/changed_bench.jpeg"], "text": "How to edit image1 to make it look like image2?"}],
253
+ [{"files": [f"{cur_dir}/examples/twitter2.jpeg",f"{cur_dir}/examples/twitter3.jpeg",f"{cur_dir}/examples/twitter4.jpeg"], "text": "Please write a twitter blog post with the images."}],
254
+ # [{"files": [f"{cur_dir}/examples/twitter3.jpeg",f"{cur_dir}/examples/twitter4.jpeg"], "text": "Please write a twitter blog post with the images."}],
255
+ # [{"files": [f"playground/demo/examples/lion1_.mp4",f"playground/demo/examples/lion2_.mp4"], "text": "The input contains two videos, the first half is the first video and the second half is the second video. What is the difference between the two videos?"}],
256
+
257
+ ], inputs=[chat_input], label="Compare images: ",examples_per_page=3)
258
 
259
+
260
+
261
+
262
 
 
 
263
 
264
  demo.queue()
265
  if __name__ == "__main__":