khirodsahoo93 commited on
Commit
67d1b33
·
verified ·
1 Parent(s): c5ab68d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -19,6 +19,8 @@ import socket
19
  import httpx
20
  from openai import OpenAI
21
  import anthropic
 
 
22
  import gradio as gr
23
 
24
  # Try to load from .env file if available
@@ -203,6 +205,11 @@ print(f"Execution Time: {(end_time - start_time):.6f} seconds")
203
 
204
  # Modern CSS
205
  modern_css = """
 
 
 
 
 
206
  .gradio-container {
207
  max-width: 1400px !important;
208
  margin: 0 auto !important;
@@ -418,12 +425,26 @@ modern_css = """
418
  padding: 10px 12px;
419
  border-radius: 10px;
420
  }
 
 
 
 
 
 
 
 
421
  """
422
 
423
  # Create the interface with password protection
424
  def create_interface():
425
  with gr.Blocks(css=modern_css, title="Python to C++ Code Optimizer", theme=gr.themes.Soft()) as app:
426
  authorized = gr.State(False)
 
 
 
 
 
 
427
 
428
  def check_password(pw):
429
  ok = pw == APP_PASSWORD
@@ -436,6 +457,8 @@ def create_interface():
436
  # Login gate
437
  with gr.Group(visible=True) as login_group:
438
  gr.HTML('<div class="login-wrapper"><div class="login-card">')
 
 
439
  gr.HTML('<div class="login-title">🔐 Private Access</div>')
440
  gr.HTML('<div class="login-subtitle">Enter the shared password to continue</div>')
441
  pw = gr.Textbox(label="Password", type="password", placeholder="Enter password", elem_classes=["login-input"])
 
19
  import httpx
20
  from openai import OpenAI
21
  import anthropic
22
+ # Workaround for Python 3.13 where stdlib audioop is removed; instruct pydub to use pure-python fallback
23
+ os.environ.setdefault("PYDUB_SIMPLE_AUDIOOP", "1")
24
  import gradio as gr
25
 
26
  # Try to load from .env file if available
 
205
 
206
  # Modern CSS
207
  modern_css = """
208
+ .gradio-container, body, html {
209
+ background: #f9fafb !important; /* light background to avoid dark-mode conflicts */
210
+ color: #111827 !important; /* ensure readable text */
211
+ }
212
+
213
  .gradio-container {
214
  max-width: 1400px !important;
215
  margin: 0 auto !important;
 
425
  padding: 10px 12px;
426
  border-radius: 10px;
427
  }
428
+
429
+ .login-hero img {
430
+ width: 100% !important;
431
+ height: 160px !important;
432
+ object-fit: cover !important;
433
+ border-radius: 12px !important;
434
+ margin-bottom: 12px !important;
435
+ }
436
  """
437
 
438
  # Create the interface with password protection
439
  def create_interface():
440
  with gr.Blocks(css=modern_css, title="Python to C++ Code Optimizer", theme=gr.themes.Soft()) as app:
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
 
457
  # Login gate
458
  with gr.Group(visible=True) as login_group:
459
  gr.HTML('<div class="login-wrapper"><div class="login-card">')
460
+ if BANNER_URL:
461
+ gr.Image(value=BANNER_URL, show_label=False, elem_classes=["login-hero"])
462
  gr.HTML('<div class="login-title">🔐 Private Access</div>')
463
  gr.HTML('<div class="login-subtitle">Enter the shared password to continue</div>')
464
  pw = gr.Textbox(label="Password", type="password", placeholder="Enter password", elem_classes=["login-input"])