Spaces:
Sleeping
Sleeping
Rajan Sharma
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
from functools import lru_cache
|
| 4 |
-
from datetime import datetime, timezone
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
import torch
|
|
@@ -195,12 +194,13 @@ h1 {
|
|
| 195 |
font-size: 28px !important;
|
| 196 |
}
|
| 197 |
|
| 198 |
-
/*
|
|
|
|
| 199 |
.chatbot .label,
|
| 200 |
.chatbot .label-wrap,
|
| 201 |
-
.chatbot header,
|
| 202 |
.chatbot .top,
|
| 203 |
-
.chatbot .header
|
|
|
|
| 204 |
display: none !important;
|
| 205 |
}
|
| 206 |
|
|
@@ -208,6 +208,8 @@ h1 {
|
|
| 208 |
.message.user, .message.bot {
|
| 209 |
background: var(--brand-accent) !important;
|
| 210 |
color: var(--brand-text-light) !important;
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
|
| 213 |
/* Inputs a bit softer */
|
|
@@ -220,12 +222,35 @@ textarea, input, .gr-input {
|
|
| 220 |
# UI
|
| 221 |
# -------------------
|
| 222 |
with gr.Blocks(theme=theme, css=custom_css) as demo:
|
| 223 |
-
#
|
| 224 |
tz_box = gr.Textbox(visible=False)
|
| 225 |
demo.load(lambda tz: tz, inputs=[tz_box], outputs=[tz_box],
|
| 226 |
js="() => Intl.DateTimeFormat().resolvedOptions().timeZone")
|
| 227 |
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
gr.ChatInterface(
|
| 231 |
fn=chat_fn,
|
|
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
from functools import lru_cache
|
|
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
import torch
|
|
|
|
| 194 |
font-size: 28px !important;
|
| 195 |
}
|
| 196 |
|
| 197 |
+
/* Try to hide the default Chatbot label via CSS for multiple Gradio builds */
|
| 198 |
+
.chatbot header,
|
| 199 |
.chatbot .label,
|
| 200 |
.chatbot .label-wrap,
|
|
|
|
| 201 |
.chatbot .top,
|
| 202 |
+
.chatbot .header,
|
| 203 |
+
.chatbot > .wrap > header {
|
| 204 |
display: none !important;
|
| 205 |
}
|
| 206 |
|
|
|
|
| 208 |
.message.user, .message.bot {
|
| 209 |
background: var(--brand-accent) !important;
|
| 210 |
color: var(--brand-text-light) !important;
|
| 211 |
+
border-radius: 12px !important;
|
| 212 |
+
padding: 8px 12px !important;
|
| 213 |
}
|
| 214 |
|
| 215 |
/* Inputs a bit softer */
|
|
|
|
| 222 |
# UI
|
| 223 |
# -------------------
|
| 224 |
with gr.Blocks(theme=theme, css=custom_css) as demo:
|
| 225 |
+
# Hidden box to carry timezone (still useful for future features)
|
| 226 |
tz_box = gr.Textbox(visible=False)
|
| 227 |
demo.load(lambda tz: tz, inputs=[tz_box], outputs=[tz_box],
|
| 228 |
js="() => Intl.DateTimeFormat().resolvedOptions().timeZone")
|
| 229 |
|
| 230 |
+
# Extra JS hard-removal of the Chatbot label to cover all DOM variants
|
| 231 |
+
hide_label_sink = gr.HTML(visible=False)
|
| 232 |
+
demo.load(
|
| 233 |
+
fn=lambda: "",
|
| 234 |
+
inputs=None,
|
| 235 |
+
outputs=hide_label_sink,
|
| 236 |
+
js="""
|
| 237 |
+
() => {
|
| 238 |
+
const sel = [
|
| 239 |
+
'.chatbot header',
|
| 240 |
+
'.chatbot .label',
|
| 241 |
+
'.chatbot .label-wrap',
|
| 242 |
+
'.chatbot .top',
|
| 243 |
+
'.chatbot .header',
|
| 244 |
+
'.chatbot > .wrap > header'
|
| 245 |
+
];
|
| 246 |
+
sel.forEach(s => document.querySelectorAll(s).forEach(el => el.style.display = 'none'));
|
| 247 |
+
return "";
|
| 248 |
+
}
|
| 249 |
+
"""
|
| 250 |
+
)
|
| 251 |
+
|
| 252 |
+
# Updated title
|
| 253 |
+
gr.Markdown("# ClarityOps Augmented Decision AI")
|
| 254 |
|
| 255 |
gr.ChatInterface(
|
| 256 |
fn=chat_fn,
|