sflindrs commited on
Commit
05a348e
·
verified ·
1 Parent(s): b67c0c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -45,14 +45,15 @@ def process_image_and_text(image, text):
45
 
46
  return generated_text
47
 
48
- def chatbot(image, text, history):
49
  if image is None:
50
  return history + [("Please upload an image first.", None)]
51
 
52
  response = process_image_and_text(image, text)
53
  pretty_response = pprint.pp(response)
54
 
55
- history.append((text, pretty_response))
 
56
  return history
57
 
58
  # Define the Gradio interface
 
45
 
46
  return generated_text
47
 
48
+ def chatbot(image, text, history, type='messages'):
49
  if image is None:
50
  return history + [("Please upload an image first.", None)]
51
 
52
  response = process_image_and_text(image, text)
53
  pretty_response = pprint.pp(response)
54
 
55
+ history.append({"role": "user", "content": text})
56
+ history.append({"role": "assistant", "content": pretty_response})
57
  return history
58
 
59
  # Define the Gradio interface