wannaphong commited on
Commit
a96c874
·
1 Parent(s): 60efd34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -299,8 +299,6 @@ with gr.Blocks(height=900) as demo:
299
 
300
  [Blog](https://medium.com/@iwishcognitivedissonance/wangchanglm-the-thai-turned-multilingual-instruction-following-model-7aa9a0f51f5f) | [Codes](https://github.com/pythainlp/wangchanglm) | [Demo](https://colab.research.google.com/github/pythainlp/WangChanGLM/blob/main/demo/WangChanGLM_v0_1_demo.ipynb)
301
 
302
- ![](https://i.imgur.com/RL5Mqs3.png)
303
-
304
 
305
  This demo use CPU only, so It may be slow or very slow. If you want the speed, try [Google colab](https://colab.research.google.com/github/pythainlp/WangChanGLM/blob/main/demo/WangChanGLM_v0_1_demo.ipynb).
306
 
@@ -355,10 +353,10 @@ with gr.Blocks(height=900) as demo:
355
  _temp= instruct_generate(instruct,input,max_gen_len,temperature,top_p)
356
  feedback_gen_box.update(visible=True)
357
  return {outputs:_temp,feedback_gen_box: gr.update(visible=True),feedback_gen_ok: gr.update(visible=False)}
358
- feedback_gen_submit.click(fn=save_up2, inputs=[instruction, input,outputs,max_len,temp,top_p,gen_radio,feedback_gen], outputs=[feedback_gen_box,feedback_gen_ok])
359
  inputs = [instruction, input, max_len, temp, top_p]
360
  run_botton.click(fn=gen, inputs=inputs, outputs=[outputs,feedback_gen_box,feedback_gen_ok])
361
- examples = gr.Examples(examples=["แต่งกลอนวันแม่","แต่งกลอนแปดวันแม่",'อยากลดความอ้วนทำไง','จงแต่งเรียงความเรื่องความฝันของคนรุ่นใหม่ต่อประเทศไทย'],inputs=[instruction])
362
  with gr.Tab("ChatBot"):
363
  with gr.Column():
364
  chatbot = gr.Chatbot(label="Chat Message Box", placeholder="Chat Message Box",show_label=False).style(container=False)
@@ -398,7 +396,7 @@ with gr.Blocks(height=900) as demo:
398
  def reset():
399
  chatgpt_chain.memory.clear()
400
  print("clear!")
401
- feedback_chatbot_submit.click(fn=save_up, inputs=[chatbot,chatbot_radio,feedback_chatbot], outputs=[feedback_chatbot_ok,feedback_chatbot_box,])
402
  clear.click(reset, None, chatbot, queue=False)
403
  submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
404
  submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
@@ -433,7 +431,7 @@ with gr.Blocks(height=900) as demo:
433
  x=sumbit_data(save="chat",prompt=_bot,vote=3,feedback=feedback,name_model=name_model+"-chat_old")
434
  return {feedback_chatbot_ok2: gr.update(visible=True),feedback_chatbot_box2: gr.update(visible=False)}
435
  msg2.submit(user2, [msg2, chatbot2], [msg2, chatbot2], queue=True).then(bot2, chatbot2, [chatbot2,feedback_chatbot_box2])
436
- feedback_chatbot_submit2.click(fn=save_up2, inputs=[chatbot2,chatbot_radio2,feedback_chatbot2], outputs=[feedback_chatbot_ok2,feedback_chatbot_box2])
437
  clear2 = gr.Button("Clear")
438
  clear2.click(lambda: None, None, chatbot2, queue=False)
439
  demo.queue()
 
299
 
300
  [Blog](https://medium.com/@iwishcognitivedissonance/wangchanglm-the-thai-turned-multilingual-instruction-following-model-7aa9a0f51f5f) | [Codes](https://github.com/pythainlp/wangchanglm) | [Demo](https://colab.research.google.com/github/pythainlp/WangChanGLM/blob/main/demo/WangChanGLM_v0_1_demo.ipynb)
301
 
 
 
302
 
303
  This demo use CPU only, so It may be slow or very slow. If you want the speed, try [Google colab](https://colab.research.google.com/github/pythainlp/WangChanGLM/blob/main/demo/WangChanGLM_v0_1_demo.ipynb).
304
 
 
353
  _temp= instruct_generate(instruct,input,max_gen_len,temperature,top_p)
354
  feedback_gen_box.update(visible=True)
355
  return {outputs:_temp,feedback_gen_box: gr.update(visible=True),feedback_gen_ok: gr.update(visible=False)}
356
+ feedback_gen_submit.click(fn=save_up2, inputs=[instruction, input,outputs,max_len,temp,top_p,gen_radio,feedback_gen], outputs=[feedback_gen_box,feedback_gen_ok], queue=False)
357
  inputs = [instruction, input, max_len, temp, top_p]
358
  run_botton.click(fn=gen, inputs=inputs, outputs=[outputs,feedback_gen_box,feedback_gen_ok])
359
+ examples = gr.Examples(examples=['อยากลดความอ้วนทำไง','จงแต่งเรียงความเรื่องความฝันของคนรุ่นใหม่ต่อประเทศไทย'],inputs=[instruction])
360
  with gr.Tab("ChatBot"):
361
  with gr.Column():
362
  chatbot = gr.Chatbot(label="Chat Message Box", placeholder="Chat Message Box",show_label=False).style(container=False)
 
396
  def reset():
397
  chatgpt_chain.memory.clear()
398
  print("clear!")
399
+ feedback_chatbot_submit.click(fn=save_up, inputs=[chatbot,chatbot_radio,feedback_chatbot], outputs=[feedback_chatbot_ok,feedback_chatbot_box,], queue=False)
400
  clear.click(reset, None, chatbot, queue=False)
401
  submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
402
  submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
 
431
  x=sumbit_data(save="chat",prompt=_bot,vote=3,feedback=feedback,name_model=name_model+"-chat_old")
432
  return {feedback_chatbot_ok2: gr.update(visible=True),feedback_chatbot_box2: gr.update(visible=False)}
433
  msg2.submit(user2, [msg2, chatbot2], [msg2, chatbot2], queue=True).then(bot2, chatbot2, [chatbot2,feedback_chatbot_box2])
434
+ feedback_chatbot_submit2.click(fn=save_up2, inputs=[chatbot2,chatbot_radio2,feedback_chatbot2], outputs=[feedback_chatbot_ok2,feedback_chatbot_box2], queue=False)
435
  clear2 = gr.Button("Clear")
436
  clear2.click(lambda: None, None, chatbot2, queue=False)
437
  demo.queue()