Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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(
|
|
|
|
| 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
|