Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
import json
|
| 4 |
import os
|
|
|
|
| 5 |
|
| 6 |
API_URL = "https://host.palple.polrambora.com/pmsq"
|
| 7 |
|
|
@@ -91,17 +92,19 @@ def render_message(history):
|
|
| 91 |
|
| 92 |
for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history:
|
| 93 |
if user_message:
|
|
|
|
| 94 |
messages_html += f"""
|
| 95 |
<div style='display: flex; align-items: center; margin-bottom: 10px;'>
|
| 96 |
<img src='{user_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>
|
| 97 |
-
<span style='color: white;'>{
|
| 98 |
</div><br>"""
|
| 99 |
|
| 100 |
if assistant_message:
|
|
|
|
| 101 |
messages_html += f"""
|
| 102 |
<div style='display: flex; align-items: center; margin-bottom: 10px;'>
|
| 103 |
<img src='{assistant_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>
|
| 104 |
-
<span style='color: white;'>{
|
| 105 |
</div><br>"""
|
| 106 |
|
| 107 |
messages_html += "</div></div>"
|
|
|
|
| 2 |
import requests
|
| 3 |
import json
|
| 4 |
import os
|
| 5 |
+
import markdown
|
| 6 |
|
| 7 |
API_URL = "https://host.palple.polrambora.com/pmsq"
|
| 8 |
|
|
|
|
| 92 |
|
| 93 |
for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history:
|
| 94 |
if user_message:
|
| 95 |
+
user_message_html = markdown.markdown(user_message)
|
| 96 |
messages_html += f"""
|
| 97 |
<div style='display: flex; align-items: center; margin-bottom: 10px;'>
|
| 98 |
<img src='{user_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>
|
| 99 |
+
<span style='color: white;'><b>{user_profile}:</b> {user_message_html}</span>
|
| 100 |
</div><br>"""
|
| 101 |
|
| 102 |
if assistant_message:
|
| 103 |
+
assistant_message_html = markdown.markdown(assistant_message)
|
| 104 |
messages_html += f"""
|
| 105 |
<div style='display: flex; align-items: center; margin-bottom: 10px;'>
|
| 106 |
<img src='{assistant_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>
|
| 107 |
+
<span style='color: white;'><b>{assistant_profile}:</b> {assistant_message_html}</span>
|
| 108 |
</div><br>"""
|
| 109 |
|
| 110 |
messages_html += "</div></div>"
|