Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,11 +229,93 @@ def respond(message, history):
|
|
| 229 |
# Create the Gradio interface
|
| 230 |
demo = gr.ChatInterface(
|
| 231 |
fn=respond,
|
| 232 |
-
chatbot=gr.Chatbot(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
description="# OpenGPT 4o \n ### chat, generate images, perform web searches, and Q&A with images.",
|
| 234 |
textbox=gr.MultimodalTextbox(),
|
| 235 |
multimodal=True,
|
| 236 |
concurrency_limit=200,
|
| 237 |
cache_examples=False,
|
| 238 |
)
|
| 239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
# Create the Gradio interface
|
| 230 |
demo = gr.ChatInterface(
|
| 231 |
fn=respond,
|
| 232 |
+
chatbot=gr.Chatbot(
|
| 233 |
+
show_copy_button=True,
|
| 234 |
+
likeable=True,
|
| 235 |
+
layout="custom",
|
| 236 |
+
chatbot_class="custom-chatbot",
|
| 237 |
+
),
|
| 238 |
description="# OpenGPT 4o \n ### chat, generate images, perform web searches, and Q&A with images.",
|
| 239 |
textbox=gr.MultimodalTextbox(),
|
| 240 |
multimodal=True,
|
| 241 |
concurrency_limit=200,
|
| 242 |
cache_examples=False,
|
| 243 |
)
|
| 244 |
+
|
| 245 |
+
canvas = gr.HTML(
|
| 246 |
+
"""
|
| 247 |
+
<style>
|
| 248 |
+
.custom-chatbot {
|
| 249 |
+
width: 100%;
|
| 250 |
+
height: 80vh;
|
| 251 |
+
border: 1px solid #ccc;
|
| 252 |
+
border-radius: 10px;
|
| 253 |
+
padding: 20px;
|
| 254 |
+
background-color: #f7f7f7;
|
| 255 |
+
}
|
| 256 |
+
.chatbot-header {
|
| 257 |
+
font-size: 20px;
|
| 258 |
+
font-weight: bold;
|
| 259 |
+
display: flex;
|
| 260 |
+
justify-content: space-between;
|
| 261 |
+
align-items: center;
|
| 262 |
+
padding: 10px;
|
| 263 |
+
border-bottom: 1px solid #ccc;
|
| 264 |
+
}
|
| 265 |
+
.chatbot-header.title {
|
| 266 |
+
font-size: 18px;
|
| 267 |
+
}
|
| 268 |
+
.chatbot-header.logout {
|
| 269 |
+
font-size: 14px;
|
| 270 |
+
cursor: pointer;
|
| 271 |
+
margin-left: 10px;
|
| 272 |
+
}
|
| 273 |
+
.chatbot-header.logout:hover {
|
| 274 |
+
text-decoration: underline;
|
| 275 |
+
}
|
| 276 |
+
.chat-message {
|
| 277 |
+
display: flex;
|
| 278 |
+
flex-direction: column;
|
| 279 |
+
align-items: flex-start;
|
| 280 |
+
padding: 10px;
|
| 281 |
+
}
|
| 282 |
+
.chat-message.text {
|
| 283 |
+
background-color: #fff;
|
| 284 |
+
padding: 10px;
|
| 285 |
+
border-radius: 10px;
|
| 286 |
+
}
|
| 287 |
+
.chat-message.text.self {
|
| 288 |
+
background-color: #dafff7;
|
| 289 |
+
}
|
| 290 |
+
.chat-message.text.date {
|
| 291 |
+
font-size: 12px;
|
| 292 |
+
color: #666;
|
| 293 |
+
margin-top: 5px;
|
| 294 |
+
}
|
| 295 |
+
.chat-message.input {
|
| 296 |
+
flex-grow: 1;
|
| 297 |
+
padding: 10px;
|
| 298 |
+
border: 1px solid #ccc;
|
| 299 |
+
border-radius: 10px;
|
| 300 |
+
font-size: 16px;
|
| 301 |
+
}
|
| 302 |
+
</style>
|
| 303 |
+
<div class="custom-chatbot">
|
| 304 |
+
<header class="chatbot-header">
|
| 305 |
+
<div class="title">OpenGPT Chatbot</div>
|
| 306 |
+
<div class="logout" onclick="logout()">Logout</div>
|
| 307 |
+
</header>
|
| 308 |
+
<div class="chat-messages">
|
| 309 |
+
<div class="chat-message" id="messages-container">
|
| 310 |
+
<!-- messages will be rendered here -->
|
| 311 |
+
</div>
|
| 312 |
+
<div class="chat-input">
|
| 313 |
+
<input type="text" id="chat-input" />
|
| 314 |
+
<button id="send-btn">Send</button>
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
</div>
|
| 318 |
+
"""
|
| 319 |
+
)
|
| 320 |
+
|
| 321 |
+
demo.launch(canvas=canvas)
|