Vision-CAIR commited on
Commit
d771171
β€’
1 Parent(s): c72cf96

Update minigpt4/conversation/conversation.py

Browse files
minigpt4/conversation/conversation.py CHANGED
@@ -196,7 +196,7 @@ class Chat:
196
 
197
  def encode_img(self, img_list):
198
  image = img_list[0]
199
- img_list = []
200
  if isinstance(image, str): # is a image path
201
  raw_image = Image.open(image).convert('RGB')
202
  image = self.vis_processor(raw_image).unsqueeze(0).to(self.device)
@@ -210,14 +210,13 @@ class Chat:
210
 
211
  image_emb, _ = self.model.encode_img(image)
212
  img_list.append(image_emb)
213
- return img_list
214
 
215
  def upload_img(self, image, conv, img_list):
216
  conv.append_message(conv.roles[0], "<Img><ImageHere></Img>")
217
  img_list.append(image)
218
  msg = "Received."
219
 
220
- return msg, img_list
221
 
222
  def get_context_emb(self, conv, img_list):
223
  prompt = conv.get_prompt()
 
196
 
197
  def encode_img(self, img_list):
198
  image = img_list[0]
199
+ img_list.clear()
200
  if isinstance(image, str): # is a image path
201
  raw_image = Image.open(image).convert('RGB')
202
  image = self.vis_processor(raw_image).unsqueeze(0).to(self.device)
 
210
 
211
  image_emb, _ = self.model.encode_img(image)
212
  img_list.append(image_emb)
 
213
 
214
  def upload_img(self, image, conv, img_list):
215
  conv.append_message(conv.roles[0], "<Img><ImageHere></Img>")
216
  img_list.append(image)
217
  msg = "Received."
218
 
219
+ return msg
220
 
221
  def get_context_emb(self, conv, img_list):
222
  prompt = conv.get_prompt()