layerdiffusion commited on
Commit
992e391
1 Parent(s): 6fb0c53
Files changed (2) hide show
  1. app.py +2 -1
  2. chat_interface.py +5 -2
app.py CHANGED
@@ -366,7 +366,8 @@ with gr.Blocks(
366
  undo_btn=undo_btn,
367
  clear_btn=clear_btn,
368
  additional_inputs=[seed, temperature, top_p, max_new_tokens],
369
- examples=examples
 
370
  )
371
 
372
  render_button.click(
 
366
  undo_btn=undo_btn,
367
  clear_btn=clear_btn,
368
  additional_inputs=[seed, temperature, top_p, max_new_tokens],
369
+ examples=examples,
370
+ show_stop_button=False
371
  )
372
 
373
  render_button.click(
chat_interface.py CHANGED
@@ -57,6 +57,7 @@ class ChatInterface(Blocks):
57
  pre_fn: Callable,
58
  chatbot: Chatbot,
59
  *,
 
60
  post_fn_kwargs: dict = None,
61
  pre_fn_kwargs: dict = None,
62
  multimodal: bool = False,
@@ -103,6 +104,8 @@ class ChatInterface(Blocks):
103
  self.pre_fn = pre_fn
104
  self.pre_fn_kwargs = pre_fn_kwargs
105
 
 
 
106
  self.interrupter = State(None)
107
 
108
  self.multimodal = multimodal
@@ -409,7 +412,7 @@ class ChatInterface(Blocks):
409
  async_lambda(
410
  lambda: (
411
  Button(visible=False),
412
- Button(visible=True),
413
  )
414
  ),
415
  None,
@@ -427,7 +430,7 @@ class ChatInterface(Blocks):
427
  else:
428
  for event_trigger in event_triggers:
429
  event_trigger(
430
- async_lambda(lambda: Button(visible=True)),
431
  None,
432
  [self.stop_btn],
433
  show_api=False,
 
57
  pre_fn: Callable,
58
  chatbot: Chatbot,
59
  *,
60
+ show_stop_button=True,
61
  post_fn_kwargs: dict = None,
62
  pre_fn_kwargs: dict = None,
63
  multimodal: bool = False,
 
104
  self.pre_fn = pre_fn
105
  self.pre_fn_kwargs = pre_fn_kwargs
106
 
107
+ self.show_stop_button = show_stop_button
108
+
109
  self.interrupter = State(None)
110
 
111
  self.multimodal = multimodal
 
412
  async_lambda(
413
  lambda: (
414
  Button(visible=False),
415
+ Button(visible=self.show_stop_button),
416
  )
417
  ),
418
  None,
 
430
  else:
431
  for event_trigger in event_triggers:
432
  event_trigger(
433
+ async_lambda(lambda: Button(visible=self.show_stop_button)),
434
  None,
435
  [self.stop_btn],
436
  show_api=False,