vilarin commited on
Commit
67d3fd3
1 Parent(s): 50517e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -59,10 +59,11 @@ def stream_chat(message, history: list, temperature: float, max_new_tokens: int)
59
  if len(history) == 0:
60
  raise gr.Error("Please upload an image first.")
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}])
68
  conversation.append({"role": "user", "content": message['text']})
 
59
  if len(history) == 0:
60
  raise gr.Error("Please upload an image first.")
61
  image = None
62
+ else:
63
  image = Image.open(history[0][0][0])
 
64
  for prompt, answer in history:
65
+ if answer is None:
66
+ conversation.extend([{"role": "user", "content":""}])
67
  conversation[0]['content'] = f"<|image_1|>\n{prompt}"
68
  conversation.extend([{"role": "assistant", "content": answer}])
69
  conversation.append({"role": "user", "content": message['text']})