pan-yl commited on
Commit
121fe52
1 Parent(s): 27db4aa

update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -77,7 +77,6 @@ class ChatBotUI(object):
77
  cfg_file=self.model_choices[self.model_name])
78
  self.pipe = ACEInference()
79
  self.pipe.init_from_cfg(model_cfg)
80
- self.retry_msg = ''
81
  self.max_msgs = 20
82
 
83
  self.enable_i2v = cfg.get('ENABLE_I2V', False)
@@ -179,6 +178,7 @@ class ChatBotUI(object):
179
  self.history = gr.State(value=[])
180
  self.images = gr.State(value={})
181
  self.history_result = gr.State(value={})
 
182
  with gr.Group():
183
  with gr.Row(equal_height=True):
184
  with gr.Column(visible=True) as self.chat_page:
@@ -601,7 +601,7 @@ class ChatBotUI(object):
601
  video_fps,
602
  video_seed,
603
  progress=gr.Progress(track_tqdm=True)):
604
- self.retry_msg = message
605
  gen_id = get_md5(message)[:12]
606
  save_path = os.path.join(self.cache_dir, f'{gen_id}.png')
607
 
@@ -774,7 +774,7 @@ class ChatBotUI(object):
774
  history.pop(0)
775
 
776
  return history, images, history_result, self.get_history(
777
- history), gr.update(value=''), gr.update(visible=False)
778
 
779
  chat_inputs = [
780
  self.extend_prompt, self.history, self.images, self.use_history,
@@ -787,7 +787,7 @@ class ChatBotUI(object):
787
 
788
  chat_outputs = [
789
  self.history, self.images, self.history_result, self.chatbot,
790
- self.text, self.gallery
791
  ]
792
 
793
  self.chat_btn.click(run_chat,
@@ -798,13 +798,8 @@ class ChatBotUI(object):
798
  inputs=[self.text] + chat_inputs,
799
  outputs=chat_outputs)
800
 
801
- ########################################
802
- @spaces.GPU(duration=60)
803
- def retry_chat(*args):
804
- return run_chat(self.retry_msg, *args)
805
-
806
- self.retry_btn.click(retry_chat,
807
- inputs=chat_inputs,
808
  outputs=chat_outputs)
809
 
810
  ########################################
 
77
  cfg_file=self.model_choices[self.model_name])
78
  self.pipe = ACEInference()
79
  self.pipe.init_from_cfg(model_cfg)
 
80
  self.max_msgs = 20
81
 
82
  self.enable_i2v = cfg.get('ENABLE_I2V', False)
 
178
  self.history = gr.State(value=[])
179
  self.images = gr.State(value={})
180
  self.history_result = gr.State(value={})
181
+ self.retry_msg = gr.State(value='')
182
  with gr.Group():
183
  with gr.Row(equal_height=True):
184
  with gr.Column(visible=True) as self.chat_page:
 
601
  video_fps,
602
  video_seed,
603
  progress=gr.Progress(track_tqdm=True)):
604
+ retry_msg = message
605
  gen_id = get_md5(message)[:12]
606
  save_path = os.path.join(self.cache_dir, f'{gen_id}.png')
607
 
 
774
  history.pop(0)
775
 
776
  return history, images, history_result, self.get_history(
777
+ history), gr.update(value=''), gr.update(visible=False), gr.update(value=retry_msg)
778
 
779
  chat_inputs = [
780
  self.extend_prompt, self.history, self.images, self.use_history,
 
787
 
788
  chat_outputs = [
789
  self.history, self.images, self.history_result, self.chatbot,
790
+ self.text, self.gallery, self.retry_msg
791
  ]
792
 
793
  self.chat_btn.click(run_chat,
 
798
  inputs=[self.text] + chat_inputs,
799
  outputs=chat_outputs)
800
 
801
+ self.retry_btn.click(run_chat,
802
+ inputs=[self.retry_msg] + chat_inputs,
 
 
 
 
 
803
  outputs=chat_outputs)
804
 
805
  ########################################