Spaces:
Running
Running
Nattapong Tapachoom
commited on
Commit
·
9161a49
1
Parent(s):
ef1d1b7
Revamp CSS for a modern aesthetic with a light blue theme and improved component styling in Gradio app
Browse files
app.py
CHANGED
|
@@ -264,44 +264,31 @@ def analyze_text(text: str, model_name: str) -> str:
|
|
| 264 |
# Modern CSS with dark blue theme
|
| 265 |
CUSTOM_CSS = """
|
| 266 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
| 267 |
-
|
| 268 |
* {
|
| 269 |
font-family: 'Inter', 'Noto Sans Thai', sans-serif !important;
|
| 270 |
}
|
| 271 |
-
|
| 272 |
.gradio-container {
|
| 273 |
max-width: 1200px !important;
|
| 274 |
margin: 0 auto !important;
|
| 275 |
-
background: linear-gradient(135deg, #
|
| 276 |
min-height: 100vh;
|
| 277 |
padding: 20px;
|
| 278 |
}
|
| 279 |
-
|
| 280 |
-
.
|
| 281 |
-
|
| 282 |
-
backdrop-filter: blur(20px) !important;
|
| 283 |
border-radius: 24px !important;
|
| 284 |
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.
|
| 285 |
-
border:
|
| 286 |
overflow: hidden;
|
|
|
|
| 287 |
}
|
| 288 |
-
|
| 289 |
-
.glass-card {
|
| 290 |
-
background: rgba(30, 58, 138, 0.9) !important;
|
| 291 |
-
backdrop-filter: blur(12px) !important;
|
| 292 |
-
border-radius: 16px !important;
|
| 293 |
-
border: 1px solid rgba(59, 130, 246, 0.3) !important;
|
| 294 |
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
|
| 295 |
-
transition: all 0.3s ease !important;
|
| 296 |
-
}
|
| 297 |
-
|
| 298 |
.glass-card:hover {
|
| 299 |
transform: translateY(-2px) !important;
|
| 300 |
-
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.
|
| 301 |
}
|
| 302 |
-
|
| 303 |
.gr-button {
|
| 304 |
-
background: linear-gradient(
|
| 305 |
border: none !important;
|
| 306 |
border-radius: 12px !important;
|
| 307 |
padding: 12px 24px !important;
|
|
@@ -309,88 +296,64 @@ CUSTOM_CSS = """
|
|
| 309 |
text-transform: uppercase !important;
|
| 310 |
letter-spacing: 0.5px !important;
|
| 311 |
transition: all 0.3s ease !important;
|
| 312 |
-
box-shadow: 0 4px 15px rgba(
|
| 313 |
-
color: #
|
| 314 |
}
|
| 315 |
-
|
| 316 |
.gr-button:hover {
|
| 317 |
transform: translateY(-2px) !important;
|
| 318 |
-
box-shadow: 0 6px 20px rgba(
|
| 319 |
}
|
| 320 |
-
|
| 321 |
.gr-button.secondary {
|
| 322 |
-
background: linear-gradient(
|
| 323 |
-
|
|
|
|
| 324 |
}
|
| 325 |
-
|
| 326 |
.gr-button.secondary:hover {
|
| 327 |
-
box-shadow: 0 6px 20px rgba(
|
| 328 |
}
|
| 329 |
-
|
| 330 |
.gr-textbox textarea, .gr-textbox input {
|
| 331 |
border-radius: 12px !important;
|
| 332 |
-
border: 2px solid
|
| 333 |
font-size: 16px !important;
|
| 334 |
padding: 16px !important;
|
| 335 |
transition: all 0.3s ease !important;
|
| 336 |
-
background:
|
| 337 |
-
color: #
|
| 338 |
}
|
| 339 |
-
|
| 340 |
.gr-textbox textarea:focus, .gr-textbox input:focus {
|
| 341 |
-
border-color: #
|
| 342 |
-
box-shadow: 0 0 0 3px rgba(
|
| 343 |
transform: scale(1.01) !important;
|
| 344 |
}
|
| 345 |
-
|
| 346 |
.gr-dropdown > div {
|
| 347 |
border-radius: 12px !important;
|
| 348 |
-
border: 2px solid
|
| 349 |
-
background:
|
| 350 |
-
color: #
|
| 351 |
}
|
| 352 |
-
|
| 353 |
.gr-dropdown > div:focus-within {
|
| 354 |
-
border-color: #
|
| 355 |
-
box-shadow: 0 0 0 3px rgba(
|
| 356 |
}
|
| 357 |
-
|
| 358 |
-
.gr-panel {
|
| 359 |
border-radius: 16px !important;
|
| 360 |
border: none !important;
|
| 361 |
background: transparent !important;
|
| 362 |
}
|
| 363 |
-
|
| 364 |
-
.gr-form {
|
| 365 |
-
background: transparent !important;
|
| 366 |
-
border: none !important;
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
.gr-box {
|
| 370 |
-
border: none !important;
|
| 371 |
-
background: transparent !important;
|
| 372 |
-
}
|
| 373 |
-
|
| 374 |
-
/* Custom scrollbar */
|
| 375 |
::-webkit-scrollbar {
|
| 376 |
width: 8px;
|
| 377 |
}
|
| 378 |
-
|
| 379 |
::-webkit-scrollbar-track {
|
| 380 |
-
background:
|
| 381 |
border-radius: 4px;
|
| 382 |
}
|
| 383 |
-
|
| 384 |
::-webkit-scrollbar-thumb {
|
| 385 |
-
background:
|
| 386 |
border-radius: 4px;
|
| 387 |
}
|
| 388 |
-
|
| 389 |
::-webkit-scrollbar-thumb:hover {
|
| 390 |
-
background:
|
| 391 |
}
|
| 392 |
-
|
| 393 |
-
/* Animation for content */
|
| 394 |
@keyframes slideIn {
|
| 395 |
from {
|
| 396 |
opacity: 0;
|
|
@@ -401,29 +364,24 @@ CUSTOM_CSS = """
|
|
| 401 |
transform: translateY(0);
|
| 402 |
}
|
| 403 |
}
|
| 404 |
-
|
| 405 |
.gr-column, .gr-row {
|
| 406 |
animation: slideIn 0.6s ease-out !important;
|
| 407 |
}
|
| 408 |
-
|
| 409 |
-
/* Enhanced examples styling */
|
| 410 |
.gr-examples {
|
| 411 |
border-radius: 16px !important;
|
| 412 |
overflow: hidden !important;
|
| 413 |
}
|
| 414 |
-
|
| 415 |
.gr-examples .gr-button {
|
| 416 |
-
background:
|
| 417 |
-
border: 1px solid
|
| 418 |
margin: 4px !important;
|
| 419 |
font-size: 14px !important;
|
| 420 |
text-transform: none !important;
|
| 421 |
letter-spacing: normal !important;
|
| 422 |
-
color: #
|
| 423 |
}
|
| 424 |
-
|
| 425 |
.gr-examples .gr-button:hover {
|
| 426 |
-
background:
|
| 427 |
transform: scale(1.02) !important;
|
| 428 |
}
|
| 429 |
"""
|
|
@@ -443,12 +401,12 @@ with gr.Blocks(
|
|
| 443 |
# Header with dark blue design
|
| 444 |
gr.HTML("""
|
| 445 |
<div style="text-align: center; padding: 40px 0 30px 0;">
|
| 446 |
-
<div style="display: inline-block; background:
|
| 447 |
-
<h1 style="font-size: 3.5em; margin: 0; color: #
|
| 448 |
<span style="font-size: 1.2em;">🧠</span>
|
| 449 |
Thai Sentiment AI
|
| 450 |
</h1>
|
| 451 |
-
<p style="font-size: 1.4em; color: #
|
| 452 |
ระบบวิเคราะห์ความรู้สึกภาษาไทยด้วย AI ที่ทันสมัยและแม่นยำ
|
| 453 |
</p>
|
| 454 |
</div>
|
|
|
|
| 264 |
# Modern CSS with dark blue theme
|
| 265 |
CUSTOM_CSS = """
|
| 266 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
|
|
|
| 267 |
* {
|
| 268 |
font-family: 'Inter', 'Noto Sans Thai', sans-serif !important;
|
| 269 |
}
|
|
|
|
| 270 |
.gradio-container {
|
| 271 |
max-width: 1200px !important;
|
| 272 |
margin: 0 auto !important;
|
| 273 |
+
background: linear-gradient(135deg, #e0f7fa 0%, #b2f7ef 100%) !important;
|
| 274 |
min-height: 100vh;
|
| 275 |
padding: 20px;
|
| 276 |
}
|
| 277 |
+
.main-content, .glass-card {
|
| 278 |
+
background: rgba(255,255,255,0.95) !important;
|
| 279 |
+
backdrop-filter: blur(12px) !important;
|
|
|
|
| 280 |
border-radius: 24px !important;
|
| 281 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
|
| 282 |
+
border: 1.5px solid #b2dfdb !important;
|
| 283 |
overflow: hidden;
|
| 284 |
+
color: #1a3c3d !important;
|
| 285 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
.glass-card:hover {
|
| 287 |
transform: translateY(-2px) !important;
|
| 288 |
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
|
| 289 |
}
|
|
|
|
| 290 |
.gr-button {
|
| 291 |
+
background: linear-gradient(90deg, #26c6da 0%, #43e97b 100%) !important;
|
| 292 |
border: none !important;
|
| 293 |
border-radius: 12px !important;
|
| 294 |
padding: 12px 24px !important;
|
|
|
|
| 296 |
text-transform: uppercase !important;
|
| 297 |
letter-spacing: 0.5px !important;
|
| 298 |
transition: all 0.3s ease !important;
|
| 299 |
+
box-shadow: 0 4px 15px rgba(38, 198, 218, 0.13) !important;
|
| 300 |
+
color: #fff !important;
|
| 301 |
}
|
|
|
|
| 302 |
.gr-button:hover {
|
| 303 |
transform: translateY(-2px) !important;
|
| 304 |
+
box-shadow: 0 6px 20px rgba(38, 198, 218, 0.18) !important;
|
| 305 |
}
|
|
|
|
| 306 |
.gr-button.secondary {
|
| 307 |
+
background: linear-gradient(90deg, #b2f7ef 0%, #e0f7fa 100%) !important;
|
| 308 |
+
color: #1a3c3d !important;
|
| 309 |
+
box-shadow: 0 4px 15px rgba(178, 247, 239, 0.13) !important;
|
| 310 |
}
|
|
|
|
| 311 |
.gr-button.secondary:hover {
|
| 312 |
+
box-shadow: 0 6px 20px rgba(178, 247, 239, 0.18) !important;
|
| 313 |
}
|
|
|
|
| 314 |
.gr-textbox textarea, .gr-textbox input {
|
| 315 |
border-radius: 12px !important;
|
| 316 |
+
border: 2px solid #b2dfdb !important;
|
| 317 |
font-size: 16px !important;
|
| 318 |
padding: 16px !important;
|
| 319 |
transition: all 0.3s ease !important;
|
| 320 |
+
background: #f8fffe !important;
|
| 321 |
+
color: #1a3c3d !important;
|
| 322 |
}
|
|
|
|
| 323 |
.gr-textbox textarea:focus, .gr-textbox input:focus {
|
| 324 |
+
border-color: #26c6da !important;
|
| 325 |
+
box-shadow: 0 0 0 3px rgba(38, 198, 218, 0.13) !important;
|
| 326 |
transform: scale(1.01) !important;
|
| 327 |
}
|
|
|
|
| 328 |
.gr-dropdown > div {
|
| 329 |
border-radius: 12px !important;
|
| 330 |
+
border: 2px solid #b2dfdb !important;
|
| 331 |
+
background: #f8fffe !important;
|
| 332 |
+
color: #1a3c3d !important;
|
| 333 |
}
|
|
|
|
| 334 |
.gr-dropdown > div:focus-within {
|
| 335 |
+
border-color: #26c6da !important;
|
| 336 |
+
box-shadow: 0 0 0 3px rgba(38, 198, 218, 0.13) !important;
|
| 337 |
}
|
| 338 |
+
.gr-panel, .gr-form, .gr-box {
|
|
|
|
| 339 |
border-radius: 16px !important;
|
| 340 |
border: none !important;
|
| 341 |
background: transparent !important;
|
| 342 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
::-webkit-scrollbar {
|
| 344 |
width: 8px;
|
| 345 |
}
|
|
|
|
| 346 |
::-webkit-scrollbar-track {
|
| 347 |
+
background: #e0f7fa;
|
| 348 |
border-radius: 4px;
|
| 349 |
}
|
|
|
|
| 350 |
::-webkit-scrollbar-thumb {
|
| 351 |
+
background: #26c6da;
|
| 352 |
border-radius: 4px;
|
| 353 |
}
|
|
|
|
| 354 |
::-webkit-scrollbar-thumb:hover {
|
| 355 |
+
background: #43e97b;
|
| 356 |
}
|
|
|
|
|
|
|
| 357 |
@keyframes slideIn {
|
| 358 |
from {
|
| 359 |
opacity: 0;
|
|
|
|
| 364 |
transform: translateY(0);
|
| 365 |
}
|
| 366 |
}
|
|
|
|
| 367 |
.gr-column, .gr-row {
|
| 368 |
animation: slideIn 0.6s ease-out !important;
|
| 369 |
}
|
|
|
|
|
|
|
| 370 |
.gr-examples {
|
| 371 |
border-radius: 16px !important;
|
| 372 |
overflow: hidden !important;
|
| 373 |
}
|
|
|
|
| 374 |
.gr-examples .gr-button {
|
| 375 |
+
background: #e0f7fa !important;
|
| 376 |
+
border: 1px solid #b2dfdb !important;
|
| 377 |
margin: 4px !important;
|
| 378 |
font-size: 14px !important;
|
| 379 |
text-transform: none !important;
|
| 380 |
letter-spacing: normal !important;
|
| 381 |
+
color: #1a3c3d !important;
|
| 382 |
}
|
|
|
|
| 383 |
.gr-examples .gr-button:hover {
|
| 384 |
+
background: #b2f7ef !important;
|
| 385 |
transform: scale(1.02) !important;
|
| 386 |
}
|
| 387 |
"""
|
|
|
|
| 401 |
# Header with dark blue design
|
| 402 |
gr.HTML("""
|
| 403 |
<div style="text-align: center; padding: 40px 0 30px 0;">
|
| 404 |
+
<div style="display: inline-block; background: #e0f7fa; padding: 20px 40px; border-radius: 20px; border: 1.5px solid #b2dfdb; margin-bottom: 20px; box-shadow: 0 4px 16px #b2dfdb55;">
|
| 405 |
+
<h1 style="font-size: 3.5em; margin: 0; color: #1a3c3d; font-weight: 800; text-shadow: 0 4px 8px #b2dfdb55; display: flex; align-items: center; justify-content: center; gap: 20px;">
|
| 406 |
<span style="font-size: 1.2em;">🧠</span>
|
| 407 |
Thai Sentiment AI
|
| 408 |
</h1>
|
| 409 |
+
<p style="font-size: 1.4em; color: #26c6da; margin: 10px 0 0 0; font-weight: 400; text-shadow: 0 2px 4px #b2dfdb33;">
|
| 410 |
ระบบวิเคราะห์ความรู้สึกภาษาไทยด้วย AI ที่ทันสมัยและแม่นยำ
|
| 411 |
</p>
|
| 412 |
</div>
|