han1997 commited on
Commit
99c6873
·
verified ·
1 Parent(s): d9f9e4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -44,6 +44,9 @@ prompt_builder = vlm.get_prompt_builder()
44
  def bot_streaming(message, history, temperature, top_k, max_new_tokens):
45
  if len(history) == 0:
46
  prompt_builder.prompt, prompt_builder.turn_count = "", 0
 
 
 
47
  if message["files"]:
48
  image = message["files"][-1]["path"]
49
  else:
@@ -53,7 +56,8 @@ def bot_streaming(message, history, temperature, top_k, max_new_tokens):
53
  if type(hist[0])==tuple:
54
  image = hist[0][0]
55
 
56
- image = Image.open(image).convert("RGB")
 
57
 
58
  prompt_builder.add_turn(role="human", message=message['text'])
59
  prompt_text = prompt_builder.get_prompt()
 
44
  def bot_streaming(message, history, temperature, top_k, max_new_tokens):
45
  if len(history) == 0:
46
  prompt_builder.prompt, prompt_builder.turn_count = "", 0
47
+
48
+ image = None
49
+
50
  if message["files"]:
51
  image = message["files"][-1]["path"]
52
  else:
 
56
  if type(hist[0])==tuple:
57
  image = hist[0][0]
58
 
59
+ if image is not None:
60
+ image = Image.open(image).convert("RGB")
61
 
62
  prompt_builder.add_turn(role="human", message=message['text'])
63
  prompt_text = prompt_builder.get_prompt()