Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -657,11 +657,11 @@ class XylariaChat:
|
|
| 657 |
base64_image = base64.b64encode(image_bytes).decode("utf-8")
|
| 658 |
image_html = f'<img src="data:image/png;base64,{base64_image}" alt="Generated Image" style="max-width: 100%; max-height: 400px;">'
|
| 659 |
|
| 660 |
-
# Replace loading SVG with the generated image
|
| 661 |
chat_history[-1][1] = image_html
|
| 662 |
|
| 663 |
self.conversation_history.append(ChatMessage(role="user", content=message).to_dict())
|
| 664 |
-
self.conversation_history.append(ChatMessage(role="assistant", content=image_html).to_dict())
|
| 665 |
|
| 666 |
yield "", chat_history, None, None
|
| 667 |
else:
|
|
|
|
| 657 |
base64_image = base64.b64encode(image_bytes).decode("utf-8")
|
| 658 |
image_html = f'<img src="data:image/png;base64,{base64_image}" alt="Generated Image" style="max-width: 100%; max-height: 400px;">'
|
| 659 |
|
| 660 |
+
# Replace loading SVG with the generated image in the AI's chat bubble
|
| 661 |
chat_history[-1][1] = image_html
|
| 662 |
|
| 663 |
self.conversation_history.append(ChatMessage(role="user", content=message).to_dict())
|
| 664 |
+
self.conversation_history.append(ChatMessage(role="assistant", content=image_html).to_dict()) # Correctly append image to conversation history
|
| 665 |
|
| 666 |
yield "", chat_history, None, None
|
| 667 |
else:
|