Spaces:
Build error
Build error
Create htmlTemplate.py
Browse files- htmlTemplate.py +105 -0
htmlTemplate.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
css = '''
|
| 2 |
+
<style>
|
| 3 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');
|
| 4 |
+
body {
|
| 5 |
+
background-color: #f4f6f9;
|
| 6 |
+
font-family: 'Inter', sans-serif;
|
| 7 |
+
}
|
| 8 |
+
.chat-container {
|
| 9 |
+
max-width: 800px;
|
| 10 |
+
margin: 0 auto;
|
| 11 |
+
padding: 20px;
|
| 12 |
+
}
|
| 13 |
+
.chat-message {
|
| 14 |
+
display: flex;
|
| 15 |
+
margin-bottom: 1.5rem;
|
| 16 |
+
border-radius: 12px;
|
| 17 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 18 |
+
overflow: hidden;
|
| 19 |
+
transition: all 0.3s ease;
|
| 20 |
+
}
|
| 21 |
+
.chat-message:hover {
|
| 22 |
+
transform: translateY(-5px);
|
| 23 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
| 24 |
+
}
|
| 25 |
+
.chat-message.user {
|
| 26 |
+
background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
|
| 27 |
+
color: white;
|
| 28 |
+
}
|
| 29 |
+
.chat-message.bot {
|
| 30 |
+
background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
|
| 31 |
+
color: white;
|
| 32 |
+
}
|
| 33 |
+
.chat-message .avatar {
|
| 34 |
+
width: 15%;
|
| 35 |
+
display: flex;
|
| 36 |
+
align-items: center;
|
| 37 |
+
justify-content: center;
|
| 38 |
+
padding: 10px;
|
| 39 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 40 |
+
}
|
| 41 |
+
.chat-message .avatar img {
|
| 42 |
+
width: 50px;
|
| 43 |
+
height: 50px;
|
| 44 |
+
border-radius: 50%;
|
| 45 |
+
object-fit: cover;
|
| 46 |
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
| 47 |
+
}
|
| 48 |
+
.chat-message .message {
|
| 49 |
+
width: 85%;
|
| 50 |
+
padding: 15px;
|
| 51 |
+
font-size: 1rem;
|
| 52 |
+
line-height: 1.6;
|
| 53 |
+
}
|
| 54 |
+
.chat-message.user .message {
|
| 55 |
+
text-align: left;
|
| 56 |
+
}
|
| 57 |
+
.upload-section {
|
| 58 |
+
background-color: white;
|
| 59 |
+
border-radius: 12px;
|
| 60 |
+
padding: 20px;
|
| 61 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 62 |
+
margin-bottom: 20px;
|
| 63 |
+
}
|
| 64 |
+
.upload-section h3 {
|
| 65 |
+
color: #2575fc;
|
| 66 |
+
margin-bottom: 15px;
|
| 67 |
+
}
|
| 68 |
+
.stTextInput > div > div > input {
|
| 69 |
+
border-radius: 8px;
|
| 70 |
+
border: 1px solid #e0e0e0;
|
| 71 |
+
padding: 10px;
|
| 72 |
+
font-size: 1rem;
|
| 73 |
+
}
|
| 74 |
+
.stButton > button {
|
| 75 |
+
background-color: #2575fc !important;
|
| 76 |
+
color: white !important;
|
| 77 |
+
border-radius: 8px !important;
|
| 78 |
+
padding: 10px 20px !important;
|
| 79 |
+
transition: all 0.3s ease !important;
|
| 80 |
+
}
|
| 81 |
+
.stButton > button:hover {
|
| 82 |
+
background-color: #1a5aff !important;
|
| 83 |
+
transform: translateY(-2px);
|
| 84 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 85 |
+
}
|
| 86 |
+
</style>
|
| 87 |
+
'''
|
| 88 |
+
|
| 89 |
+
bot_template = '''
|
| 90 |
+
<div class="chat-message bot">
|
| 91 |
+
<div class="avatar">
|
| 92 |
+
<img src="https://i.imgur.com/7zxqQ3y.png" alt="Bot Avatar">
|
| 93 |
+
</div>
|
| 94 |
+
<div class="message">{{MSG}}</div>
|
| 95 |
+
</div>
|
| 96 |
+
'''
|
| 97 |
+
|
| 98 |
+
user_template = '''
|
| 99 |
+
<div class="chat-message user">
|
| 100 |
+
<div class="avatar">
|
| 101 |
+
<img src="https://i.imgur.com/3JbqQAZ.png" alt="User Avatar">
|
| 102 |
+
</div>
|
| 103 |
+
<div class="message">{{MSG}}</div>
|
| 104 |
+
</div>
|
| 105 |
+
'''
|