chansung commited on
Commit
0512804
1 Parent(s): 6f7615d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -65,7 +65,13 @@ async def chat_stream(idx, local_data, instruction_txtbox, chat_state):
65
  for result in await gen_text(prompt, hf_model=MODEL_ID, hf_token=TOKEN):
66
  ppm.append_pong(result)
67
  yield ppm.build_uis(), str(res)
68
-
 
 
 
 
 
 
69
 
70
  with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
71
  with gr.Column() as chat_view:
 
65
  for result in await gen_text(prompt, hf_model=MODEL_ID, hf_token=TOKEN):
66
  ppm.append_pong(result)
67
  yield ppm.build_uis(), str(res)
68
+
69
+ def set_chatbot(btn, ld, state):
70
+ choice = channel_num(btn)
71
+
72
+ res = [state["ppmanager_type"].from_json(json.dumps(ppm_str)) for ppm_str in ld]
73
+ empty = len(res[choice].pingpongs) == 0
74
+ return (res[choice].build_uis(), choice, gr.update(visible=empty), gr.update(interactive=not empty))
75
 
76
  with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
77
  with gr.Column() as chat_view: