vilarin commited on
Commit
50517e2
1 Parent(s): 99d36c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -51,8 +51,7 @@ eos_token_id=processor.tokenizer.eos_token_id
51
  def stream_chat(message, history: list, temperature: float, max_new_tokens: int):
52
  print(f'message is - {message}')
53
  print(f'history is - {history}')
54
- conversation = []
55
-
56
  if message["files"]:
57
  image = Image.open(message["files"][-1])
58
  conversation.append({"role": "user", "content": f"<|image_1|>\n{message['text']}"})
@@ -62,6 +61,7 @@ def stream_chat(message, history: list, temperature: float, max_new_tokens: int)
62
  image = None
63
  elif len(history):
64
  image = Image.open(history[0][0][0])
 
65
  for prompt, answer in history:
66
  conversation[0]['content'] = f"<|image_1|>\n{prompt}"
67
  conversation.extend([{"role": "assistant", "content": answer}])
 
51
  def stream_chat(message, history: list, temperature: float, max_new_tokens: int):
52
  print(f'message is - {message}')
53
  print(f'history is - {history}')
54
+ conversation = []
 
55
  if message["files"]:
56
  image = Image.open(message["files"][-1])
57
  conversation.append({"role": "user", "content": f"<|image_1|>\n{message['text']}"})
 
61
  image = None
62
  elif len(history):
63
  image = Image.open(history[0][0][0])
64
+ conversation.extend([{"role": "user", "content":""}])
65
  for prompt, answer in history:
66
  conversation[0]['content'] = f"<|image_1|>\n{prompt}"
67
  conversation.extend([{"role": "assistant", "content": answer}])