ElPlaguister commited on
Commit
94ea8ae
ยท
1 Parent(s): 10c5e96

Feat App.py Change Label Immediately

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -47,11 +47,11 @@ def chat(message, chat_history):
47
  chat_history.append((message, response))
48
  return "", gr.Chatbot(chat_history, label=MODEL_STRS[cur_index], bubble_full_width=False)
49
 
50
- def change_model_index(idx):
51
  global cur_index
52
  cur_index = idx
53
- print(cur_index)
54
- return
55
 
56
  if __name__=='__main__':
57
  theme = prepare_theme()
@@ -69,5 +69,5 @@ if __name__=='__main__':
69
  txt = gr.Textbox(show_label=False, placeholder='์—ฐ์•  ๊ด€๋ จ ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”!', container=False)
70
 
71
  txt.submit(chat, [txt, chatbot], [txt, chatbot])
72
- rd.select(change_model_index, [rd])
73
  demo.launch(debug=True, share=True)
 
47
  chat_history.append((message, response))
48
  return "", gr.Chatbot(chat_history, label=MODEL_STRS[cur_index], bubble_full_width=False)
49
 
50
+ def change_model_index(idx, chatbot):
51
  global cur_index
52
  cur_index = idx
53
+ # print(cur_index)
54
+ return gr.Chatbot(chatbot, label=MODEL_STRS[cur_index], bubble_full_width=False)
55
 
56
  if __name__=='__main__':
57
  theme = prepare_theme()
 
69
  txt = gr.Textbox(show_label=False, placeholder='์—ฐ์•  ๊ด€๋ จ ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”!', container=False)
70
 
71
  txt.submit(chat, [txt, chatbot], [txt, chatbot])
72
+ rd.select(change_model_index, [rd, chatbot], [chatbot])
73
  demo.launch(debug=True, share=True)