Rajan Sharma commited on
Commit
20ec625
·
verified ·
1 Parent(s): 7eb389a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -24,8 +24,6 @@ os.environ.setdefault("TRANSFORMERS_CACHE", HF_TRANSFORMERS) # warning is fine
24
  os.environ.setdefault("SENTENCE_TRANSFORMERS_HOME", ST_HOME)
25
  os.environ.setdefault("GRADIO_TEMP_DIR", GRADIO_TMP)
26
  os.environ.setdefault("GRADIO_CACHE_DIR", GRADIO_CACHE)
27
-
28
- # Disable experimental xet; prefer stable transfer
29
  os.environ.setdefault("HF_HUB_ENABLE_XET", "0")
30
  os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "1")
31
 
@@ -370,26 +368,35 @@ def clarityops_reply(user_msg, history, tz, uploaded_files_paths, awaiting_answe
370
  theme = gr.themes.Soft(primary_hue="teal", neutral_hue="slate", radius_size=gr.themes.sizes.radius_lg)
371
  custom_css = """
372
  :root { --brand-bg: #e6f7f8; --brand-accent: #0d9488; --brand-text: #0f172a; --brand-text-light: #ffffff; }
373
- .gradio-container { background: var(--brand-bg); }
 
 
 
 
 
374
  h1 { color: var(--brand-text); font-weight: 700; font-size: 28px !important; }
 
 
375
  .chatbot header, .chatbot .label, .chatbot .label-wrap, .chatbot .top, .chatbot .header, .chatbot > .wrap > header { display: none !important; }
376
  .message.user, .message.bot { background: var(--brand-accent) !important; color: var(--brand-text-light) !important; border-radius: 12px !important; padding: 8px 12px !important; }
377
  textarea, input, .gr-input { border-radius: 12px !important; }
378
 
379
- /* Centered handshake overlay INSIDE the chat area */
380
- #chat-container { position: relative; } /* anchor for absolute overlay */
381
 
 
382
  #handshake-overlay {
383
  position: absolute;
384
- inset: 8px; /* fill the chatbot panel with a small margin */
385
- z-index: 50;
 
386
  display: grid;
387
  place-items: center;
388
- pointer-events: none; /* do not block uploads/inputs below */
389
  }
390
 
391
  #handshake-overlay .panel {
392
- pointer-events: auto; /* clickable if needed */
393
  background: rgba(13, 148, 136, 0.96);
394
  color: #fff;
395
  padding: 18px 22px;
@@ -412,7 +419,9 @@ with gr.Blocks(theme=theme, css=custom_css, analytics_enabled=False) as demo:
412
  gr.Markdown("# ClarityOps Augmented Decision AI")
413
 
414
  with gr.Column(elem_id="chat-container"):
415
- chat = gr.Chatbot(label="", show_label=False, height=720)
 
 
416
  handshake = gr.HTML(
417
  value=(
418
  '<div id="handshake-overlay">'
@@ -446,7 +455,6 @@ with gr.Blocks(theme=theme, css=custom_css, analytics_enabled=False) as demo:
446
  paths = []
447
  for f in (files or []):
448
  paths.append(getattr(f, "name", None) or f)
449
- # Also hide banner when the first action is file upload
450
  overlay_hidden = gr.update(value='<div id="handshake-overlay" class="hidden"></div>')
451
  return (current or []) + paths, overlay_hidden
452
 
 
24
  os.environ.setdefault("SENTENCE_TRANSFORMERS_HOME", ST_HOME)
25
  os.environ.setdefault("GRADIO_TEMP_DIR", GRADIO_TMP)
26
  os.environ.setdefault("GRADIO_CACHE_DIR", GRADIO_CACHE)
 
 
27
  os.environ.setdefault("HF_HUB_ENABLE_XET", "0")
28
  os.environ.setdefault("HF_HUB_ENABLE_HF_TRANSFER", "1")
29
 
 
368
  theme = gr.themes.Soft(primary_hue="teal", neutral_hue="slate", radius_size=gr.themes.sizes.radius_lg)
369
  custom_css = """
370
  :root { --brand-bg: #e6f7f8; --brand-accent: #0d9488; --brand-text: #0f172a; --brand-text-light: #ffffff; }
371
+
372
+ /* Full-height layout */
373
+ html, body, .gradio-container { height: 100vh; }
374
+ .gradio-container { background: var(--brand-bg); display: flex; flex-direction: column; }
375
+
376
+ /* Tidy typography */
377
  h1 { color: var(--brand-text); font-weight: 700; font-size: 28px !important; }
378
+
379
+ /* Minimal chrome */
380
  .chatbot header, .chatbot .label, .chatbot .label-wrap, .chatbot .top, .chatbot .header, .chatbot > .wrap > header { display: none !important; }
381
  .message.user, .message.bot { background: var(--brand-accent) !important; color: var(--brand-text-light) !important; border-radius: 12px !important; padding: 8px 12px !important; }
382
  textarea, input, .gr-input { border-radius: 12px !important; }
383
 
384
+ /* Anchor for overlay */
385
+ #chat-container { position: relative; }
386
 
387
+ /* Centered handshake overlay INSIDE the chat area */
388
  #handshake-overlay {
389
  position: absolute;
390
+ top: 0; left: 0; right: 0; bottom: 0; /* fully cover the chat surface */
391
+ margin: 8px; /* reveal rounded corners of chat */
392
+ z-index: 9999; /* sit above the chat content */
393
  display: grid;
394
  place-items: center;
395
+ pointer-events: none; /* do not block input below */
396
  }
397
 
398
  #handshake-overlay .panel {
399
+ pointer-events: auto; /* if you later want to click to dismiss */
400
  background: rgba(13, 148, 136, 0.96);
401
  color: #fff;
402
  padding: 18px 22px;
 
419
  gr.Markdown("# ClarityOps Augmented Decision AI")
420
 
421
  with gr.Column(elem_id="chat-container"):
422
+ # Taller chat: use viewport math so UI fills the screen
423
+ chat = gr.Chatbot(label="", show_label=False, height="62vh")
424
+ # Overlay rendered as a sibling inside the same container so absolute positioning covers chat
425
  handshake = gr.HTML(
426
  value=(
427
  '<div id="handshake-overlay">'
 
455
  paths = []
456
  for f in (files or []):
457
  paths.append(getattr(f, "name", None) or f)
 
458
  overlay_hidden = gr.update(value='<div id="handshake-overlay" class="hidden"></div>')
459
  return (current or []) + paths, overlay_hidden
460