Tonic commited on
Commit
7c0dbc1
·
1 Parent(s): 2dffa82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -17
app.py CHANGED
@@ -202,24 +202,18 @@ def _launch_demo(args, model, tokenizer):
202
  Qwen-VL-Chat <a href="https://modelscope.cn/models/qwen/Qwen-VL-Chat/summary">🤖 </a> |
203
  <a href="https://huggingface.co/Qwen/Qwen-VL-Chat">🤗</a>&nbsp |
204
  &nbsp<a href="https://github.com/QwenLM/Qwen-VL">Github</a></center>""")
205
-
206
- chatbot = gr.Chatbot(label='Qwen-VL-Chat')
207
- query = gr.Textbox(lines=2, label='Input')
208
- task_history = gr.State([])
209
-
210
  with gr.Row():
211
- addfile_btn = gr.UploadButton("📁 Upload (上传文件)", file_types=["image"])
212
- submit_btn = gr.Button("🚀 Submit (发送)")
213
- regen_btn = gr.Button("🤔️ Regenerate (重试)")
214
- empty_bin = gr.Button("🧹 Clear History (清除历史)")
215
-
216
- submit_btn.click(add_text, [chatbot, task_history, query], [chatbot, task_history]).then(
217
- predict, [chatbot, task_history], [chatbot], show_progress=True
218
- )
219
- submit_btn.click(reset_user_input, [], [query])
220
- empty_bin.click(reset_state, [task_history], [chatbot], show_progress=True)
221
- regen_btn.click(regenerate, [chatbot, task_history], [chatbot], show_progress=True)
222
- addfile_btn.upload(add_file, [chatbot, task_history, addfile_btn], [chatbot, task_history], show_progress=True)
223
 
224
  gr.Markdown("""\
225
  <font size=2>Note: This demo is governed by the original license of Qwen-VL. \
@@ -228,6 +222,16 @@ including hate speech, violence, pornography, deception, etc. \
228
  (注:本演示受Qwen-VL的许可协议限制。我们强烈建议,用户不应传播及不应允许他人传播以下内容,\
229
  包括但不限于仇恨言论、暴力、色情、欺诈相关的有害信息。)""")
230
 
 
 
 
 
 
 
 
 
 
 
231
  demo.queue().launch(
232
  share=args.share,
233
  inbrowser=args.inbrowser,
 
202
  Qwen-VL-Chat <a href="https://modelscope.cn/models/qwen/Qwen-VL-Chat/summary">🤖 </a> |
203
  <a href="https://huggingface.co/Qwen/Qwen-VL-Chat">🤗</a>&nbsp |
204
  &nbsp<a href="https://github.com/QwenLM/Qwen-VL">Github</a></center>""")
 
 
 
 
 
205
  with gr.Row():
206
+ with gr.Column(scale=1):
207
+ chatbot = gr.Chatbot(label='Qwen-VL-Chat', interactive=True, max_messages=20)
208
+ with gr.Column(scale=1):
209
+ with gr.Row():
210
+ query = gr.Textbox(lines=2, label='Input', placeholder="Type your message here...")
211
+ submit_btn = gr.Button("🚀 Submit")
212
+ with gr.Row():
213
+ addfile_btn = gr.UploadButton("📁 Upload Image", file_types=["image"])
214
+ regen_btn = gr.Button("🤔️ Regenerate")
215
+ empty_bin = gr.Button("🧹 Clear History")
216
+ task_history = gr.State([])
 
217
 
218
  gr.Markdown("""\
219
  <font size=2>Note: This demo is governed by the original license of Qwen-VL. \
 
222
  (注:本演示受Qwen-VL的许可协议限制。我们强烈建议,用户不应传播及不应允许他人传播以下内容,\
223
  包括但不限于仇恨言论、暴力、色情、欺诈相关的有害信息。)""")
224
 
225
+ demo.style(
226
+ '''
227
+ <style>
228
+ .gr-button { margin: 5px; }
229
+ .gr-textbox { margin-bottom: 10px; }
230
+ .gr-chatbot { height: 500px; }
231
+ </style>
232
+ '''
233
+ )
234
+
235
  demo.queue().launch(
236
  share=args.share,
237
  inbrowser=args.inbrowser,