AdrienB134 commited on
Commit
1784c2c
·
1 Parent(s): 2e15984
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -41,11 +41,8 @@ def model_inference(
41
 
42
  BAD_WORDS_IDS = id_processor.tokenizer(["<image>", "<fake_token_around_image>"], add_special_tokens=False).input_ids
43
  EOS_WORDS_IDS = [id_processor.tokenizer.eos_token_id]
44
- print(type(images))
45
- print(images[0])
46
- images = Image.open(images[0][0])
47
- print(images)
48
- print(type(images))
49
  if text == "" and not images:
50
  gr.Error("Please input a query and optionally image(s).")
51
 
 
41
 
42
  BAD_WORDS_IDS = id_processor.tokenizer(["<image>", "<fake_token_around_image>"], add_special_tokens=False).input_ids
43
  EOS_WORDS_IDS = [id_processor.tokenizer.eos_token_id]
44
+ images = [{"type": "image", "image": Image.open(image[0])} for image in images]
45
+ images.append({"type": "text", "text": text})
 
 
 
46
  if text == "" and not images:
47
  gr.Error("Please input a query and optionally image(s).")
48