BK-Lee commited on
Commit
f9b8fd9
·
1 Parent(s): abca37c
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -79,14 +79,15 @@ def bot_streaming(message, history, link, temperature, new_max_token, top_p):
79
  try:
80
  # prompt type -> input prompt
81
  image_token_number = None
82
- if len(message['files']) != 0:
83
  # Image Load
84
  image = pil_to_tensor(Image.open(message['files'][0]).convert("RGB"))
85
  if "3.8B" not in link:
86
  image_token_number = 1225
87
  image = F.interpolate(image.unsqueeze(0), size=(490, 490), mode='bicubic').squeeze(0)
88
  inputs = [{'image': image, 'question': message['text']}]
89
-
 
90
  else:
91
  inputs = [{'question': message['text']}]
92
 
@@ -117,7 +118,7 @@ def bot_streaming(message, history, link, temperature, new_max_token, top_p):
117
  response = output_filtering(generated_text, model)
118
 
119
  except:
120
- response = "There may be unsupported format: ex) pdf, video, sound. Only supported is single image in this version."
121
 
122
  # private log print
123
  text = message['text']
 
79
  try:
80
  # prompt type -> input prompt
81
  image_token_number = None
82
+ if len(message['files']) == 1:
83
  # Image Load
84
  image = pil_to_tensor(Image.open(message['files'][0]).convert("RGB"))
85
  if "3.8B" not in link:
86
  image_token_number = 1225
87
  image = F.interpolate(image.unsqueeze(0), size=(490, 490), mode='bicubic').squeeze(0)
88
  inputs = [{'image': image, 'question': message['text']}]
89
+ elif len(message['files']) > 1:
90
+ raise Exception("No way!")
91
  else:
92
  inputs = [{'question': message['text']}]
93
 
 
118
  response = output_filtering(generated_text, model)
119
 
120
  except:
121
+ response = "There may be unsupported format: ex) pdf, video, sound. Only supported is a single image in this version."
122
 
123
  # private log print
124
  text = message['text']