Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -379,59 +379,101 @@ modern_css = """
|
|
| 379 |
}
|
| 380 |
|
| 381 |
/* Login styling */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
.login-wrapper {
|
| 383 |
display: flex;
|
| 384 |
align-items: center;
|
| 385 |
justify-content: center;
|
| 386 |
-
min-height:
|
|
|
|
|
|
|
| 387 |
}
|
| 388 |
|
| 389 |
.login-card {
|
| 390 |
-
max-width:
|
| 391 |
width: 100%;
|
| 392 |
-
background:
|
| 393 |
-
|
| 394 |
-
border
|
| 395 |
-
|
| 396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
}
|
| 398 |
|
| 399 |
.login-title {
|
| 400 |
text-align: center;
|
| 401 |
-
margin: 0 0
|
| 402 |
-
font-size:
|
| 403 |
font-weight: 700;
|
| 404 |
-
color: #
|
|
|
|
| 405 |
}
|
| 406 |
|
| 407 |
.login-subtitle {
|
| 408 |
text-align: center;
|
| 409 |
-
margin: 0 0
|
| 410 |
-
font-size:
|
| 411 |
color: #6b7280;
|
|
|
|
| 412 |
}
|
| 413 |
|
| 414 |
-
.login-input {
|
| 415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
border: 2px solid #e5e7eb !important;
|
| 417 |
border-radius: 10px !important;
|
| 418 |
-
padding: 12px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
}
|
| 420 |
|
| 421 |
.login-error {
|
| 422 |
-
color: #
|
| 423 |
background: #fee2e2;
|
| 424 |
-
border: 1px solid #
|
| 425 |
-
padding:
|
| 426 |
border-radius: 10px;
|
|
|
|
|
|
|
| 427 |
}
|
| 428 |
|
| 429 |
-
.
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
}
|
| 436 |
"""
|
| 437 |
|
|
@@ -441,10 +483,7 @@ def create_interface():
|
|
| 441 |
authorized = gr.State(False)
|
| 442 |
BANNER_URL = os.getenv("BANNER_URL", "")
|
| 443 |
BACKGROUND_URL = os.getenv("BACKGROUND_URL", "")
|
| 444 |
-
|
| 445 |
-
# Optional global background image
|
| 446 |
-
if BACKGROUND_URL:
|
| 447 |
-
gr.HTML(f"<style>body, .gradio-container {{ background: url('{BACKGROUND_URL}') center/cover no-repeat fixed !important; }}</style>")
|
| 448 |
|
| 449 |
def check_password(pw):
|
| 450 |
ok = pw == APP_PASSWORD
|
|
@@ -456,15 +495,27 @@ def create_interface():
|
|
| 456 |
|
| 457 |
# Login gate
|
| 458 |
with gr.Group(visible=True) as login_group:
|
| 459 |
-
gr.HTML(
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 466 |
login_error = gr.Markdown(visible=False, elem_classes=["login-error"])
|
| 467 |
-
gr.HTML(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 468 |
|
| 469 |
# Main UI wrapped for toggling visibility
|
| 470 |
with gr.Group(visible=False) as main_group:
|
|
|
|
| 379 |
}
|
| 380 |
|
| 381 |
/* Login styling */
|
| 382 |
+
body, .gradio-container {
|
| 383 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
.login-wrapper {
|
| 387 |
display: flex;
|
| 388 |
align-items: center;
|
| 389 |
justify-content: center;
|
| 390 |
+
min-height: 100vh;
|
| 391 |
+
padding: 24px;
|
| 392 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 393 |
}
|
| 394 |
|
| 395 |
.login-card {
|
| 396 |
+
max-width: 400px;
|
| 397 |
width: 100%;
|
| 398 |
+
background: rgba(255, 255, 255, 0.95);
|
| 399 |
+
backdrop-filter: blur(10px);
|
| 400 |
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
| 401 |
+
border-radius: 20px;
|
| 402 |
+
padding: 48px 40px;
|
| 403 |
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
.login-icon {
|
| 407 |
+
font-size: 56px;
|
| 408 |
+
text-align: center;
|
| 409 |
+
margin-bottom: 16px;
|
| 410 |
+
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
|
| 411 |
}
|
| 412 |
|
| 413 |
.login-title {
|
| 414 |
text-align: center;
|
| 415 |
+
margin: 0 0 8px 0;
|
| 416 |
+
font-size: 28px;
|
| 417 |
font-weight: 700;
|
| 418 |
+
color: #1f2937;
|
| 419 |
+
letter-spacing: -0.02em;
|
| 420 |
}
|
| 421 |
|
| 422 |
.login-subtitle {
|
| 423 |
text-align: center;
|
| 424 |
+
margin: 0 0 32px 0;
|
| 425 |
+
font-size: 15px;
|
| 426 |
color: #6b7280;
|
| 427 |
+
font-weight: 400;
|
| 428 |
}
|
| 429 |
|
| 430 |
+
.login-input label {
|
| 431 |
+
color: #374151 !important;
|
| 432 |
+
font-weight: 600 !important;
|
| 433 |
+
font-size: 14px !important;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
.login-input input {
|
| 437 |
+
background: white !important;
|
| 438 |
border: 2px solid #e5e7eb !important;
|
| 439 |
border-radius: 10px !important;
|
| 440 |
+
padding: 12px 16px !important;
|
| 441 |
+
font-size: 16px !important;
|
| 442 |
+
color: #111827 !important;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
.login-input input:focus {
|
| 446 |
+
border-color: #667eea !important;
|
| 447 |
+
background: white !important;
|
| 448 |
+
outline: none !important;
|
| 449 |
+
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
|
| 450 |
}
|
| 451 |
|
| 452 |
.login-error {
|
| 453 |
+
color: #dc2626;
|
| 454 |
background: #fee2e2;
|
| 455 |
+
border: 1px solid #fca5a5;
|
| 456 |
+
padding: 12px;
|
| 457 |
border-radius: 10px;
|
| 458 |
+
text-align: center;
|
| 459 |
+
font-weight: 500;
|
| 460 |
}
|
| 461 |
|
| 462 |
+
.freepik-credit {
|
| 463 |
+
margin-top: 24px;
|
| 464 |
+
text-align: center;
|
| 465 |
+
font-size: 12px;
|
| 466 |
+
color: #9ca3af;
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
.freepik-credit a {
|
| 470 |
+
color: #667eea;
|
| 471 |
+
text-decoration: none;
|
| 472 |
+
font-weight: 500;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
.freepik-credit a:hover {
|
| 476 |
+
text-decoration: underline;
|
| 477 |
}
|
| 478 |
"""
|
| 479 |
|
|
|
|
| 483 |
authorized = gr.State(False)
|
| 484 |
BANNER_URL = os.getenv("BANNER_URL", "")
|
| 485 |
BACKGROUND_URL = os.getenv("BACKGROUND_URL", "")
|
| 486 |
+
# Intentionally not rendering a banner image to avoid empty placeholders
|
|
|
|
|
|
|
|
|
|
| 487 |
|
| 488 |
def check_password(pw):
|
| 489 |
ok = pw == APP_PASSWORD
|
|
|
|
| 495 |
|
| 496 |
# Login gate
|
| 497 |
with gr.Group(visible=True) as login_group:
|
| 498 |
+
gr.HTML("""
|
| 499 |
+
<div class="login-wrapper">
|
| 500 |
+
<div class="login-card">
|
| 501 |
+
<div class="login-icon">🔐</div>
|
| 502 |
+
<div class="login-title">Private Access</div>
|
| 503 |
+
<div class="login-subtitle">Enter password to continue</div>
|
| 504 |
+
""")
|
| 505 |
+
pw = gr.Textbox(
|
| 506 |
+
label="Password",
|
| 507 |
+
type="password",
|
| 508 |
+
placeholder="Enter password",
|
| 509 |
+
elem_classes=["login-input"],
|
| 510 |
+
container=True
|
| 511 |
+
)
|
| 512 |
+
login_btn = gr.Button("Continue", elem_classes=["modern-button"], size="lg")
|
| 513 |
login_error = gr.Markdown(visible=False, elem_classes=["login-error"])
|
| 514 |
+
gr.HTML("""
|
| 515 |
+
<div class="freepik-credit">Background design inspired by <a href="https://www.freepik.com" target="_blank">Freepik</a></div>
|
| 516 |
+
</div>
|
| 517 |
+
</div>
|
| 518 |
+
""")
|
| 519 |
|
| 520 |
# Main UI wrapped for toggling visibility
|
| 521 |
with gr.Group(visible=False) as main_group:
|