Spaces:
Sleeping
Sleeping
Adjusting style
Browse files
app.py
CHANGED
|
@@ -164,21 +164,10 @@ def respond_with_enhanced_streaming(message, history):
|
|
| 164 |
|
| 165 |
# --- Fixed Gradio UI and CSS ---
|
| 166 |
custom_css = """
|
| 167 |
-
/* Reset and base styling */
|
| 168 |
-
html, body {
|
| 169 |
-
margin: 0;
|
| 170 |
-
padding: 0;
|
| 171 |
-
height: 100%;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
/* Main container styling */
|
| 175 |
.gradio-container {
|
| 176 |
background-color: rgb(240, 236, 230) !important;
|
| 177 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| 178 |
-
height: 100vh !important;
|
| 179 |
-
max-width: none !important;
|
| 180 |
-
margin: 0 !important;
|
| 181 |
-
padding: 0 !important;
|
| 182 |
}
|
| 183 |
|
| 184 |
/* Title styling */
|
|
@@ -196,24 +185,20 @@ html, body {
|
|
| 196 |
margin: 0;
|
| 197 |
}
|
| 198 |
|
| 199 |
-
/* Chat container
|
| 200 |
.chat-container {
|
| 201 |
-
height:
|
| 202 |
-
min-height: 400px !important;
|
| 203 |
background-color: rgb(240, 236, 230);
|
| 204 |
}
|
| 205 |
|
| 206 |
-
/* Chatbot
|
| 207 |
-
.
|
| 208 |
-
height: 100% !important;
|
| 209 |
-
min-height: 400px !important;
|
| 210 |
-
max-height: none !important;
|
| 211 |
background-color: transparent !important;
|
| 212 |
border: none !important;
|
| 213 |
padding: 20px !important;
|
| 214 |
}
|
| 215 |
|
| 216 |
-
/*
|
| 217 |
.gradio-chatbot .message.bot .markdown {
|
| 218 |
background-color: rgb(240, 185, 103) !important;
|
| 219 |
color: black !important;
|
|
@@ -250,30 +235,6 @@ html, body {
|
|
| 250 |
background-color: rgb(240, 236, 230);
|
| 251 |
border-top: 2px solid rgba(28, 18, 5, 0.1);
|
| 252 |
padding: 20px;
|
| 253 |
-
min-height: 80px;
|
| 254 |
-
}
|
| 255 |
-
|
| 256 |
-
/* Input textbox styling */
|
| 257 |
-
.input-section .gradio-textbox {
|
| 258 |
-
background-color: rgb(242, 238, 233) !important;
|
| 259 |
-
border: 2px solid rgb(28, 18, 5) !important;
|
| 260 |
-
border-radius: 20px !important;
|
| 261 |
-
margin-bottom: 10px !important;
|
| 262 |
-
}
|
| 263 |
-
|
| 264 |
-
.input-section .gradio-textbox textarea {
|
| 265 |
-
background-color: transparent !important;
|
| 266 |
-
border: none !important;
|
| 267 |
-
color: black !important;
|
| 268 |
-
padding: 15px !important;
|
| 269 |
-
font-size: 16px !important;
|
| 270 |
-
min-height: 50px !important;
|
| 271 |
-
resize: vertical !important;
|
| 272 |
-
}
|
| 273 |
-
|
| 274 |
-
.input-section .gradio-textbox textarea:focus {
|
| 275 |
-
outline: none !important;
|
| 276 |
-
box-shadow: none !important;
|
| 277 |
}
|
| 278 |
|
| 279 |
/* Clear button styling */
|
|
@@ -284,23 +245,26 @@ html, body {
|
|
| 284 |
border-radius: 10px !important;
|
| 285 |
padding: 8px 16px !important;
|
| 286 |
cursor: pointer !important;
|
| 287 |
-
|
| 288 |
}
|
| 289 |
|
| 290 |
.clear-button:hover {
|
| 291 |
background-color: rgba(28, 18, 5, 0.8) !important;
|
| 292 |
}
|
| 293 |
|
| 294 |
-
/*
|
| 295 |
-
.
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
border:
|
| 299 |
}
|
| 300 |
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
| 304 |
}
|
| 305 |
"""
|
| 306 |
|
|
@@ -309,26 +273,25 @@ with gr.Blocks(css=custom_css, title="EduBot") as demo:
|
|
| 309 |
# Title Section
|
| 310 |
gr.HTML('<div class="title-header"><h1>🎓 EduBot</h1></div>')
|
| 311 |
|
| 312 |
-
# Chat Section
|
| 313 |
with gr.Row(elem_classes=["chat-container"]):
|
| 314 |
chatbot = gr.Chatbot(
|
| 315 |
type="messages",
|
| 316 |
show_copy_button=True,
|
| 317 |
show_share_button=False,
|
| 318 |
avatar_images=None,
|
| 319 |
-
height=
|
| 320 |
)
|
| 321 |
|
| 322 |
# Input Section
|
| 323 |
with gr.Column(elem_classes=["input-section"]):
|
| 324 |
-
|
| 325 |
-
clear = gr.Button("Clear", elem_classes=["clear-button"])
|
| 326 |
msg = gr.Textbox(
|
| 327 |
placeholder="Ask me about math, research, study strategies, or any educational topic...",
|
| 328 |
show_label=False,
|
| 329 |
-
lines=
|
| 330 |
-
max_lines=
|
| 331 |
-
|
| 332 |
)
|
| 333 |
|
| 334 |
def respond_and_update(message, history):
|
|
|
|
| 164 |
|
| 165 |
# --- Fixed Gradio UI and CSS ---
|
| 166 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
/* Main container styling */
|
| 168 |
.gradio-container {
|
| 169 |
background-color: rgb(240, 236, 230) !important;
|
| 170 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
|
| 173 |
/* Title styling */
|
|
|
|
| 185 |
margin: 0;
|
| 186 |
}
|
| 187 |
|
| 188 |
+
/* Chat container */
|
| 189 |
.chat-container {
|
| 190 |
+
min-height: 500px;
|
|
|
|
| 191 |
background-color: rgb(240, 236, 230);
|
| 192 |
}
|
| 193 |
|
| 194 |
+
/* Chatbot styling */
|
| 195 |
+
.gradio-chatbot {
|
|
|
|
|
|
|
|
|
|
| 196 |
background-color: transparent !important;
|
| 197 |
border: none !important;
|
| 198 |
padding: 20px !important;
|
| 199 |
}
|
| 200 |
|
| 201 |
+
/* Message styling */
|
| 202 |
.gradio-chatbot .message.bot .markdown {
|
| 203 |
background-color: rgb(240, 185, 103) !important;
|
| 204 |
color: black !important;
|
|
|
|
| 235 |
background-color: rgb(240, 236, 230);
|
| 236 |
border-top: 2px solid rgba(28, 18, 5, 0.1);
|
| 237 |
padding: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
}
|
| 239 |
|
| 240 |
/* Clear button styling */
|
|
|
|
| 245 |
border-radius: 10px !important;
|
| 246 |
padding: 8px 16px !important;
|
| 247 |
cursor: pointer !important;
|
| 248 |
+
margin-bottom: 10px !important;
|
| 249 |
}
|
| 250 |
|
| 251 |
.clear-button:hover {
|
| 252 |
background-color: rgba(28, 18, 5, 0.8) !important;
|
| 253 |
}
|
| 254 |
|
| 255 |
+
/* Textbox styling */
|
| 256 |
+
.input-textbox {
|
| 257 |
+
background-color: rgb(242, 238, 233) !important;
|
| 258 |
+
border: 2px solid rgb(28, 18, 5) !important;
|
| 259 |
+
border-radius: 20px !important;
|
| 260 |
}
|
| 261 |
|
| 262 |
+
.input-textbox textarea {
|
| 263 |
+
background-color: transparent !important;
|
| 264 |
+
border: none !important;
|
| 265 |
+
color: black !important;
|
| 266 |
+
padding: 15px !important;
|
| 267 |
+
font-size: 16px !important;
|
| 268 |
}
|
| 269 |
"""
|
| 270 |
|
|
|
|
| 273 |
# Title Section
|
| 274 |
gr.HTML('<div class="title-header"><h1>🎓 EduBot</h1></div>')
|
| 275 |
|
| 276 |
+
# Chat Section
|
| 277 |
with gr.Row(elem_classes=["chat-container"]):
|
| 278 |
chatbot = gr.Chatbot(
|
| 279 |
type="messages",
|
| 280 |
show_copy_button=True,
|
| 281 |
show_share_button=False,
|
| 282 |
avatar_images=None,
|
| 283 |
+
height=500
|
| 284 |
)
|
| 285 |
|
| 286 |
# Input Section
|
| 287 |
with gr.Column(elem_classes=["input-section"]):
|
| 288 |
+
clear = gr.Button("Clear", elem_classes=["clear-button"])
|
|
|
|
| 289 |
msg = gr.Textbox(
|
| 290 |
placeholder="Ask me about math, research, study strategies, or any educational topic...",
|
| 291 |
show_label=False,
|
| 292 |
+
lines=3,
|
| 293 |
+
max_lines=8,
|
| 294 |
+
elem_classes=["input-textbox"]
|
| 295 |
)
|
| 296 |
|
| 297 |
def respond_and_update(message, history):
|