Spaces:
Sleeping
Sleeping
Create htmlTemplate.py
Browse files- htmlTemplate.py +67 -0
htmlTemplate.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
css = '''
|
| 2 |
+
<style>
|
| 3 |
+
.chat-message {
|
| 4 |
+
padding: 1rem;
|
| 5 |
+
border-radius: 10px;
|
| 6 |
+
margin-bottom: 1rem;
|
| 7 |
+
display: flex;
|
| 8 |
+
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
|
| 9 |
+
transition: 0.3s;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
.chat-message.user {
|
| 13 |
+
background-color: #4a69bd;
|
| 14 |
+
color: white;
|
| 15 |
+
align-items: center;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.chat-message.bot {
|
| 19 |
+
background-color: #78e08f;
|
| 20 |
+
color: black;
|
| 21 |
+
align-items: center;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.chat-message .avatar {
|
| 25 |
+
width: 15%;
|
| 26 |
+
display: flex;
|
| 27 |
+
align-items: center;
|
| 28 |
+
justify-content: center;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.chat-message .avatar img {
|
| 32 |
+
max-width: 50px;
|
| 33 |
+
max-height: 50px;
|
| 34 |
+
border-radius: 50%;
|
| 35 |
+
object-fit: cover;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.chat-message .message {
|
| 39 |
+
width: 85%;
|
| 40 |
+
padding: 0 1rem;
|
| 41 |
+
font-size: 1rem;
|
| 42 |
+
font-family: 'Arial', sans-serif;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.chat-message:hover {
|
| 46 |
+
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
|
| 47 |
+
}
|
| 48 |
+
</style>
|
| 49 |
+
'''
|
| 50 |
+
|
| 51 |
+
bot_template = '''
|
| 52 |
+
<div class="chat-message bot"">
|
| 53 |
+
<div class="avatar">
|
| 54 |
+
<img src="https://uxwing.com/wp-content/themes/uxwing/download/communication-chat-call/answer-icon.png" style="max-height: 78px; max-width: 78px; border-radius: 50%; object-fit: cover;">
|
| 55 |
+
</div>
|
| 56 |
+
<div class="message">{{MSG}}</div>
|
| 57 |
+
</div>
|
| 58 |
+
'''
|
| 59 |
+
|
| 60 |
+
user_template = '''
|
| 61 |
+
<div class="chat-message user" style="text-align: left;">
|
| 62 |
+
<div class="avatar">
|
| 63 |
+
<img src="https://cdn.iconscout.com/icon/free/png-512/free-q-characters-character-alphabet-letter-36051.png?f=webp&w=512">
|
| 64 |
+
</div>
|
| 65 |
+
<div class="message">{{MSG}}</div>
|
| 66 |
+
</div>
|
| 67 |
+
'''
|