paralym commited on
Commit
26f02ba
1 Parent(s): 8f53390

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -282,32 +282,32 @@ def add_message(history, message):
282
  history = []
283
  our_chatbot = chat_manager.get_chatbot(args, model_path, tokenizer, model, image_processor, context_len)
284
  chat_image_num = 0
285
-
286
- if len(message["files"]) <= 1:
287
- for x in message["files"]:
288
- history.append(((x,), None))
289
- chat_image_num += 1
290
- if chat_image_num > 1:
291
- history = []
292
- chat_manager.reset_chatbot()
293
- our_chatbot = chat_manager.get_chatbot(args, model_path, tokenizer, model, image_processor, context_len)
294
- chat_image_num = 0
295
- for x in message["files"]:
296
- history.append(((x,), None))
297
- chat_image_num += 1
298
 
299
- if message["text"] is not None:
300
- history.append((message["text"], None))
301
 
302
- print(f"### Chatbot instance ID: {id(our_chatbot)}")
303
- return history, gr.MultimodalTextbox(value=None, interactive=False)
304
- else:
305
- for x in message["files"]:
306
- history.append(((x,), None))
307
- if message["text"] is not None:
308
- history.append((message["text"], None))
309
-
310
- return history, gr.MultimodalTextbox(value=None, interactive=False)
311
 
312
 
313
  @spaces.GPU
 
282
  history = []
283
  our_chatbot = chat_manager.get_chatbot(args, model_path, tokenizer, model, image_processor, context_len)
284
  chat_image_num = 0
285
+
286
+ # if len(message["files"]) <= 1:
287
+ # for x in message["files"]:
288
+ # history.append(((x,), None))
289
+ # chat_image_num += 1
290
+ # if chat_image_num > 1:
291
+ # history = []
292
+ # chat_manager.reset_chatbot()
293
+ # our_chatbot = chat_manager.get_chatbot(args, model_path, tokenizer, model, image_processor, context_len)
294
+ # chat_image_num = 0
295
+ # for x in message["files"]:
296
+ # history.append(((x,), None))
297
+ # chat_image_num += 1
298
 
299
+ # if message["text"] is not None:
300
+ # history.append((message["text"], None))
301
 
302
+ # print(f"### Chatbot instance ID: {id(our_chatbot)}")
303
+ # return history, gr.MultimodalTextbox(value=None, interactive=False)
304
+ # else:
305
+ for x in message["files"]:
306
+ history.append(((x,), None))
307
+ if message["text"] is not None:
308
+ history.append((message["text"], None))
309
+ print(f"### Chatbot instance ID: {id(our_chatbot)}")
310
+ return history, gr.MultimodalTextbox(value=None, interactive=False)
311
 
312
 
313
  @spaces.GPU