chaojiemao commited on
Commit
7bed5b5
1 Parent(s): 5fbb38c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -1044,8 +1044,13 @@ class ChatBotUI(object):
1044
  img_str = f'<img src="data:image/png;base64,{img_b64}" style="pointer-events: none;">'
1045
  history = [(prompt,
1046
  f'{pre_info} The generated image is:\n {img_str}')]
 
 
 
 
 
1047
  return self.get_history(history), gr.update(value=''), gr.update(
1048
- visible=False), gr.Image(value=img), gr.update(value=-1)
1049
 
1050
  with self.eg:
1051
  self.example_task = gr.Text(label='Task Name',
 
1044
  img_str = f'<img src="data:image/png;base64,{img_b64}" style="pointer-events: none;">'
1045
  history = [(prompt,
1046
  f'{pre_info} The generated image is:\n {img_str}')]
1047
+
1048
+ img_id = get_md5(img_b64)[:12]
1049
+ save_path = os.path.join(self.cache_dir, f'{img_id}.png')
1050
+ img.convert('RGB').save(save_path)
1051
+
1052
  return self.get_history(history), gr.update(value=''), gr.update(
1053
+ visible=False), gr.Image(value=save_path), gr.update(value=-1)
1054
 
1055
  with self.eg:
1056
  self.example_task = gr.Text(label='Task Name',