ClownRat commited on
Commit
489f57c
•
1 Parent(s): a8e9a0c

Fix demo bugs.

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -136,15 +136,15 @@ def generate(image, video, message, chatbot, textbox_in, temperature, top_p, max
136
  if len(previous_image) > 0:
137
  previous_image = previous_image[0]
138
  # 2.1 new image append or pure text input will start a new conversation
139
- if previous_image != image:
140
  message.clear()
141
- one_turn_chat[0] += "\n" + show_images if image is not None else ""
142
  elif len(previous_video) > 0:
143
  previous_video = previous_video[0]
144
  # 2.2 new video append or pure text input will start a new conversation
145
- if previous_video != video:
146
  message.clear()
147
- one_turn_chat[0] += "\n" + show_images if video is not None else ""
148
 
149
  message.append({'role': 'user', 'content': textbox_in})
150
  text_en_out = handler.generate(data, message, temperature=temperature, top_p=top_p, max_output_tokens=max_output_tokens)
 
136
  if len(previous_image) > 0:
137
  previous_image = previous_image[0]
138
  # 2.1 new image append or pure text input will start a new conversation
139
+ if image is not None and os.path.basename(previous_image) != os.path.basename(image):
140
  message.clear()
141
+ one_turn_chat[0] += "\n" + show_images
142
  elif len(previous_video) > 0:
143
  previous_video = previous_video[0]
144
  # 2.2 new video append or pure text input will start a new conversation
145
+ if video is not None and os.path.basename(previous_video) != os.path.basename(video):
146
  message.clear()
147
+ one_turn_chat[0] += "\n" + show_images
148
 
149
  message.append({'role': 'user', 'content': textbox_in})
150
  text_en_out = handler.generate(data, message, temperature=temperature, top_p=top_p, max_output_tokens=max_output_tokens)