paralym commited on
Commit
58ea498
·
verified ·
1 Parent(s): 84a0ce4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -261,16 +261,21 @@ def bot(history, temperature, top_p, max_output_tokens):
261
  num_new_images = 0
262
  for i, message in enumerate(history[:-1]):
263
  if type(message[0]) is tuple:
264
- images_this_term.append(message[0][0])
265
- if is_valid_video_filename(message[0][0]):
266
- # 不接受视频
267
- raise ValueError("Video is not supported")
268
- num_new_images += our_chatbot.num_frames
269
- elif is_valid_image_filename(message[0][0]):
270
- print("#### Load image from local file",message[0][0])
271
- num_new_images += 1
272
  else:
273
- raise ValueError("Invalid image file")
 
 
 
 
 
 
 
 
 
274
  else:
275
  num_new_images = 0
276
 
 
261
  num_new_images = 0
262
  for i, message in enumerate(history[:-1]):
263
  if type(message[0]) is tuple:
264
+ print("### message[0]",message[0])
265
+ if len(message[0])>1:
266
+ gr.Warning("Only one image can be uploaded in a conversation. Please reduce the number of images and start a new conversation.")
267
+ return history
 
 
 
 
268
  else:
269
+ images_this_term.append(message[0][0])
270
+ if is_valid_video_filename(message[0][0]):
271
+ # 不接受视频
272
+ raise ValueError("Video is not supported")
273
+ num_new_images += our_chatbot.num_frames
274
+ elif is_valid_image_filename(message[0][0]):
275
+ print("#### Load image from local file",message[0][0])
276
+ num_new_images += 1
277
+ else:
278
+ raise ValueError("Invalid image file")
279
  else:
280
  num_new_images = 0
281