SungBeom commited on
Commit
e2bd716
โ€ข
1 Parent(s): 4d3a8e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -694,8 +694,7 @@ with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
694
  stage_hist = gr.Textbox(visible=dev_mod, value="stage history: ", interactive=False, label='stage history')
695
  chat_hist = gr.Textbox(visible=dev_mod, interactive=False, label='chatting_history')
696
  response_examples_text = gr.Textbox(visible=dev_mod, interactive=False, value="์ด๋ฒˆ ์ฃผ์— ์นœ๊ตฌ๋“ค๊ณผ ๋ชจ์ž„์ด ์žˆ๋Š”๋ฐ, ํ›Œ๋ฅญํ•œ ์™€์ธ ํ•œ ๋ณ‘์„ ์ถ”์ฒœํ•ด์ค„๋ž˜?|์ž…๋ฌธ์ž์—๊ฒŒ ์ข‹์€ ์™€์ธ์„ ์ถ”์ฒœํ•ด์ค„๋ž˜?|์—ฐ์ธ๊ณผ ๊ฐ€๊ธฐ ์ข‹์€ ์™€์ธ๋ฐ”๋ฅผ ์•Œ๋ ค์ค˜", label='response_examples')
697
- # btn = gr.Button("Flag", visible=dev_mod)
698
- # hf_writer.setup(components=[chat_hist, stage_hist, response_examples_text], flagging_dir="chatwine-korean")
699
 
700
  def click_flag_btn(*args):
701
  hf_writer.flag(flag_data=[*args])
@@ -766,10 +765,9 @@ with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
766
  bot_chat, [msg, chat_hist, chatbot, cur_stage], [chatbot, chat_hist]
767
  ).then(
768
  bot_response_pred, chat_hist, [user_response_examples, response_examples_text, msg]
 
 
769
  )
770
- # .then(
771
- # click_flag_btn, [chat_hist, stage_hist, response_examples_text], None
772
- # )
773
 
774
 
775
 
@@ -781,10 +779,9 @@ with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
781
  bot_chat, [msg, chat_hist, chatbot, cur_stage], [chatbot, chat_hist]
782
  ).then(
783
  bot_response_pred, chat_hist, [user_response_examples, response_examples_text, msg]
 
 
784
  )
785
- # .then(
786
- # click_flag_btn, [chat_hist, stage_hist, response_examples_text], None
787
- # )
788
 
789
 
790
 
@@ -794,6 +791,5 @@ with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
794
  outputs=[user_response_examples, cur_stage, stage_hist, chat_hist, response_examples_text],
795
  queue=False)
796
  user_response_examples.click(load_example, inputs=[response_examples_text, user_response_examples], outputs=[msg], queue=False)
797
- # btn.click(lambda *args: hf_writer.flag(args), [chat_hist, stage_hist, response_examples_text], None, preprocess=False)
798
  demo.queue(concurrency_count=100)
799
  demo.launch()
 
694
  stage_hist = gr.Textbox(visible=dev_mod, value="stage history: ", interactive=False, label='stage history')
695
  chat_hist = gr.Textbox(visible=dev_mod, interactive=False, label='chatting_history')
696
  response_examples_text = gr.Textbox(visible=dev_mod, interactive=False, value="์ด๋ฒˆ ์ฃผ์— ์นœ๊ตฌ๋“ค๊ณผ ๋ชจ์ž„์ด ์žˆ๋Š”๋ฐ, ํ›Œ๋ฅญํ•œ ์™€์ธ ํ•œ ๋ณ‘์„ ์ถ”์ฒœํ•ด์ค„๋ž˜?|์ž…๋ฌธ์ž์—๊ฒŒ ์ข‹์€ ์™€์ธ์„ ์ถ”์ฒœํ•ด์ค„๋ž˜?|์—ฐ์ธ๊ณผ ๊ฐ€๊ธฐ ์ข‹์€ ์™€์ธ๋ฐ”๋ฅผ ์•Œ๋ ค์ค˜", label='response_examples')
697
+ hf_writer.setup(components=[chat_hist, stage_hist, response_examples_text], flagging_dir="chatwine-korean")
 
698
 
699
  def click_flag_btn(*args):
700
  hf_writer.flag(flag_data=[*args])
 
765
  bot_chat, [msg, chat_hist, chatbot, cur_stage], [chatbot, chat_hist]
766
  ).then(
767
  bot_response_pred, chat_hist, [user_response_examples, response_examples_text, msg]
768
+ ).then(
769
+ click_flag_btn, [chat_hist, stage_hist, response_examples_text], None
770
  )
 
 
 
771
 
772
 
773
 
 
779
  bot_chat, [msg, chat_hist, chatbot, cur_stage], [chatbot, chat_hist]
780
  ).then(
781
  bot_response_pred, chat_hist, [user_response_examples, response_examples_text, msg]
782
+ ).then(
783
+ click_flag_btn, [chat_hist, stage_hist, response_examples_text], None
784
  )
 
 
 
785
 
786
 
787
 
 
791
  outputs=[user_response_examples, cur_stage, stage_hist, chat_hist, response_examples_text],
792
  queue=False)
793
  user_response_examples.click(load_example, inputs=[response_examples_text, user_response_examples], outputs=[msg], queue=False)
 
794
  demo.queue(concurrency_count=100)
795
  demo.launch()