chansung commited on
Commit
49dc2bd
β€’
1 Parent(s): ae23fc1

Update ui.py

Browse files
Files changed (1) hide show
  1. ui.py +4 -5
ui.py CHANGED
@@ -223,7 +223,6 @@ def add_arxiv_ids_to_queue(queue, arxiv_ids_str):
223
 
224
  def before_chat_begin():
225
  return (
226
- gr.Button(interactive=False),
227
  gr.Button(interactive=False),
228
  gr.Button(interactive=False)
229
  )
@@ -260,16 +259,16 @@ async def chat_stream(idx, local_data, user_prompt, chat_state, ctx_num_lconv=3)
260
  try:
261
  async for result in gemini_gen_text(prompt):
262
  ppm.append_pong(result)
263
- yield "", ppm.build_uis(), str(ppm), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False)
264
 
265
- yield "", ppm.build_uis(), str(ppm), gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)
266
  except Exception as e:
267
  print(str(e))
268
  gr.Warning("Gemini refused to answer further. This happens because there were some safety issues in the answer.")
269
- yield "", ppm.build_uis(), str(ppm), gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)
270
 
271
  def chat_reset(local_data, chat_state):
272
  ppm = chat_state["ppmanager_type"].from_json(json.dumps(local_data))
273
  ppm.pingpongs = []
274
 
275
- return "", ppm.build_uis(), str(ppm), gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)
 
223
 
224
  def before_chat_begin():
225
  return (
 
226
  gr.Button(interactive=False),
227
  gr.Button(interactive=False)
228
  )
 
259
  try:
260
  async for result in gemini_gen_text(prompt):
261
  ppm.append_pong(result)
262
+ yield "", ppm.build_uis(), str(ppm), gr.update(interactive=False), gr.update(interactive=False)
263
 
264
+ yield "", ppm.build_uis(), str(ppm), gr.update(interactive=True), gr.update(interactive=True)
265
  except Exception as e:
266
  print(str(e))
267
  gr.Warning("Gemini refused to answer further. This happens because there were some safety issues in the answer.")
268
+ yield "", ppm.build_uis(), str(ppm), gr.update(interactive=True), gr.update(interactive=True)
269
 
270
  def chat_reset(local_data, chat_state):
271
  ppm = chat_state["ppmanager_type"].from_json(json.dumps(local_data))
272
  ppm.pingpongs = []
273
 
274
+ return "", ppm.build_uis(), str(ppm), gr.update(interactive=True), gr.update(interactive=True)