wannaphong commited on
Commit
0273d6d
·
1 Parent(s): d0be050

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -339,7 +339,7 @@ with gr.Blocks(height=900) as demo:
339
  _temp= instruct_generate(instruct,input,max_gen_len,temperature,top_p)
340
  feedback_gen_box.update(visible=True)
341
  return {outputs:_temp,feedback_gen_box: gr.update(visible=True),feedback_gen_ok: gr.update(visible=False)}
342
- 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=True)
343
  inputs = [instruction, input, max_len, temp, top_p]
344
  run_botton.click(fn=gen, inputs=inputs, outputs=[outputs,feedback_gen_box,feedback_gen_ok])
345
  examples = gr.Examples(examples=["แต่งกลอนวันแม่","แต่งกลอนแปดวันแม่",'อยากลดความอ้วนทำไง','จงแต่งเรียงความเรื่องความฝันของคนรุ่นใหม่ต่อประเทศไทย'],inputs=[instruction])
@@ -382,7 +382,7 @@ with gr.Blocks(height=900) as demo:
382
  def reset():
383
  chatgpt_chain.memory.clear()
384
  print("clear!")
385
- feedback_chatbot_submit.click(fn=save_up, inputs=[chatbot,chatbot_radio,feedback_chatbot], outputs=[feedback_chatbot_ok,feedback_chatbot_box,], queue=True)
386
  clear.click(reset, None, chatbot, queue=False)
387
  submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
388
  submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
@@ -416,8 +416,8 @@ with gr.Blocks(height=900) as demo:
416
  else:
417
  x=sumbit_data(save="chat",prompt=_bot,vote=3,feedback=feedback,name_model=name_model+"-chat_old")
418
  return {feedback_chatbot_ok2: gr.update(visible=True),feedback_chatbot_box2: gr.update(visible=False)}
419
- msg2.submit(user2, [msg2, chatbot2], [msg2, chatbot2], queue=False).then(bot2, chatbot2, [chatbot2,feedback_chatbot_box2])
420
- feedback_chatbot_submit2.click(fn=save_up2, inputs=[chatbot2,chatbot_radio2,feedback_chatbot2], outputs=[feedback_chatbot_ok2,feedback_chatbot_box2], queue=True)
421
  clear2 = gr.Button("Clear")
422
  clear2.click(lambda: None, None, chatbot2, queue=False)
423
  demo.queue()
 
339
  _temp= instruct_generate(instruct,input,max_gen_len,temperature,top_p)
340
  feedback_gen_box.update(visible=True)
341
  return {outputs:_temp,feedback_gen_box: gr.update(visible=True),feedback_gen_ok: gr.update(visible=False)}
342
+ 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])
343
  inputs = [instruction, input, max_len, temp, top_p]
344
  run_botton.click(fn=gen, inputs=inputs, outputs=[outputs,feedback_gen_box,feedback_gen_ok])
345
  examples = gr.Examples(examples=["แต่งกลอนวันแม่","แต่งกลอนแปดวันแม่",'อยากลดความอ้วนทำไง','จงแต่งเรียงความเรื่องความฝันของคนรุ่นใหม่ต่อประเทศไทย'],inputs=[instruction])
 
382
  def reset():
383
  chatgpt_chain.memory.clear()
384
  print("clear!")
385
+ feedback_chatbot_submit.click(fn=save_up, inputs=[chatbot,chatbot_radio,feedback_chatbot], outputs=[feedback_chatbot_ok,feedback_chatbot_box,])
386
  clear.click(reset, None, chatbot, queue=False)
387
  submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
388
  submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot,feedback_chatbot_box], queue=True)
 
416
  else:
417
  x=sumbit_data(save="chat",prompt=_bot,vote=3,feedback=feedback,name_model=name_model+"-chat_old")
418
  return {feedback_chatbot_ok2: gr.update(visible=True),feedback_chatbot_box2: gr.update(visible=False)}
419
+ msg2.submit(user2, [msg2, chatbot2], [msg2, chatbot2], queue=True).then(bot2, chatbot2, [chatbot2,feedback_chatbot_box2])
420
+ feedback_chatbot_submit2.click(fn=save_up2, inputs=[chatbot2,chatbot_radio2,feedback_chatbot2], outputs=[feedback_chatbot_ok2,feedback_chatbot_box2])
421
  clear2 = gr.Button("Clear")
422
  clear2.click(lambda: None, None, chatbot2, queue=False)
423
  demo.queue()