Update app.py
Browse files
app.py
CHANGED
|
@@ -100,313 +100,10 @@ HF_IMAGE_TOKEN = bool(os.getenv("HF_READ_TOKEN"))
|
|
| 100 |
HF_VIDEO_TOKEN = bool(os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN"))
|
| 101 |
HF_TEXTGEN_TOKEN = bool(os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN"))
|
| 102 |
|
| 103 |
-
# CSS
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
.
|
| 107 |
-
text-align: center;
|
| 108 |
-
/* Ensure main title appears first, then our two subtitle lines */
|
| 109 |
-
display: grid;
|
| 110 |
-
justify-items: center;
|
| 111 |
-
}
|
| 112 |
-
.app-title::after {
|
| 113 |
-
grid-row: 2;
|
| 114 |
-
content: "General purpose tools useful for any agent.";
|
| 115 |
-
display: block;
|
| 116 |
-
font-size: 1rem;
|
| 117 |
-
font-weight: 400;
|
| 118 |
-
opacity: 0.9;
|
| 119 |
-
margin-top: 2px;
|
| 120 |
-
white-space: pre-wrap;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
/* Sidebar Container */
|
| 124 |
-
.app-sidebar {
|
| 125 |
-
background-color: rgba(255, 255, 255, 0.02) !important;
|
| 126 |
-
border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
|
| 127 |
-
}
|
| 128 |
-
@media (prefers-color-scheme: light) {
|
| 129 |
-
.app-sidebar {
|
| 130 |
-
background-color: rgba(0, 0, 0, 0.02) !important;
|
| 131 |
-
border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
|
| 132 |
-
}
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
/* Historical safeguard: if any h1 appears inside tabs, don't attach pseudo content */
|
| 136 |
-
.gradio-container [role=\"tabpanel\"] h1::before,
|
| 137 |
-
.gradio-container [role=\"tabpanel\"] h1::after {
|
| 138 |
-
content: none !important;
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
/* Information accordion - modern info cards */
|
| 142 |
-
.info-accordion {
|
| 143 |
-
margin: 8px 0 2px;
|
| 144 |
-
}
|
| 145 |
-
.info-grid {
|
| 146 |
-
display: grid;
|
| 147 |
-
gap: 12px;
|
| 148 |
-
/* Force a 2x2 layout on medium+ screens */
|
| 149 |
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
| 150 |
-
align-items: stretch;
|
| 151 |
-
}
|
| 152 |
-
/* On narrow screens, stack into a single column */
|
| 153 |
-
@media (max-width: 800px) {
|
| 154 |
-
.info-grid {
|
| 155 |
-
grid-template-columns: 1fr;
|
| 156 |
-
}
|
| 157 |
-
}
|
| 158 |
-
.info-card {
|
| 159 |
-
display: flex;
|
| 160 |
-
gap: 14px;
|
| 161 |
-
padding: 14px 16px;
|
| 162 |
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 163 |
-
background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
|
| 164 |
-
border-radius: 12px;
|
| 165 |
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
| 166 |
-
position: relative;
|
| 167 |
-
overflow: hidden;
|
| 168 |
-
backdrop-filter: blur(2px);
|
| 169 |
-
}
|
| 170 |
-
.info-card::before {
|
| 171 |
-
content: "";
|
| 172 |
-
position: absolute;
|
| 173 |
-
inset: 0;
|
| 174 |
-
border-radius: 12px;
|
| 175 |
-
pointer-events: none;
|
| 176 |
-
background: linear-gradient(90deg, rgba(99,102,241,0.06), rgba(59,130,246,0.05));
|
| 177 |
-
}
|
| 178 |
-
.info-card__icon {
|
| 179 |
-
font-size: 24px;
|
| 180 |
-
flex: 0 0 28px;
|
| 181 |
-
line-height: 1;
|
| 182 |
-
filter: saturate(1.1);
|
| 183 |
-
}
|
| 184 |
-
.info-card__body {
|
| 185 |
-
min-width: 0;
|
| 186 |
-
}
|
| 187 |
-
.info-card__body h3 {
|
| 188 |
-
margin: 0 0 6px;
|
| 189 |
-
font-size: 1.05rem;
|
| 190 |
-
}
|
| 191 |
-
.info-card__body p {
|
| 192 |
-
margin: 6px 0;
|
| 193 |
-
opacity: 0.95;
|
| 194 |
-
}
|
| 195 |
-
/* Readable code blocks inside info cards */
|
| 196 |
-
.info-card pre {
|
| 197 |
-
margin: 8px 0;
|
| 198 |
-
padding: 10px 12px;
|
| 199 |
-
background: rgba(20, 20, 30, 0.55);
|
| 200 |
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 201 |
-
border-radius: 10px;
|
| 202 |
-
overflow-x: auto;
|
| 203 |
-
white-space: pre;
|
| 204 |
-
}
|
| 205 |
-
.info-card code {
|
| 206 |
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
| 207 |
-
font-size: 0.95em;
|
| 208 |
-
}
|
| 209 |
-
.info-card pre code {
|
| 210 |
-
display: block;
|
| 211 |
-
}
|
| 212 |
-
.info-card p {
|
| 213 |
-
word-wrap: break-word;
|
| 214 |
-
overflow-wrap: break-word;
|
| 215 |
-
}
|
| 216 |
-
.info-card p code {
|
| 217 |
-
word-break: break-all;
|
| 218 |
-
}
|
| 219 |
-
.info-list {
|
| 220 |
-
margin: 6px 0 0 18px;
|
| 221 |
-
padding: 0;
|
| 222 |
-
}
|
| 223 |
-
.info-hint {
|
| 224 |
-
margin-top: 8px;
|
| 225 |
-
font-size: 0.9em;
|
| 226 |
-
opacity: 0.9;
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
/* Light theme adjustments */
|
| 230 |
-
@media (prefers-color-scheme: light) {
|
| 231 |
-
.info-card {
|
| 232 |
-
border-color: rgba(0, 0, 0, 0.08);
|
| 233 |
-
background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.9));
|
| 234 |
-
}
|
| 235 |
-
.info-card::before {
|
| 236 |
-
background: linear-gradient(90deg, rgba(99,102,241,0.08), rgba(59,130,246,0.06));
|
| 237 |
-
}
|
| 238 |
-
.info-card pre {
|
| 239 |
-
background: rgba(245, 246, 250, 0.95);
|
| 240 |
-
border-color: rgba(0, 0, 0, 0.08);
|
| 241 |
-
}
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
/* Sidebar Navigation - styled like the previous tabs */
|
| 245 |
-
.sidebar-nav {
|
| 246 |
-
background: transparent !important;
|
| 247 |
-
border: none !important;
|
| 248 |
-
padding: 0 !important;
|
| 249 |
-
}
|
| 250 |
-
.sidebar-nav .form {
|
| 251 |
-
gap: 8px !important;
|
| 252 |
-
display: flex !important;
|
| 253 |
-
flex-direction: column !important;
|
| 254 |
-
border: none !important;
|
| 255 |
-
background: transparent !important;
|
| 256 |
-
}
|
| 257 |
-
.sidebar-nav label {
|
| 258 |
-
display: flex !important;
|
| 259 |
-
align-items: center !important;
|
| 260 |
-
padding: 10px 12px !important;
|
| 261 |
-
border-radius: 10px !important;
|
| 262 |
-
border: 1px solid rgba(255, 255, 255, 0.08) !important;
|
| 263 |
-
background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03)) !important;
|
| 264 |
-
transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .06s ease !important;
|
| 265 |
-
cursor: pointer !important;
|
| 266 |
-
margin-bottom: 0 !important;
|
| 267 |
-
width: 100% !important;
|
| 268 |
-
justify-content: flex-start !important;
|
| 269 |
-
text-align: left !important;
|
| 270 |
-
}
|
| 271 |
-
.sidebar-nav label:hover {
|
| 272 |
-
border-color: rgba(99,102,241,0.28) !important;
|
| 273 |
-
background: linear-gradient(180deg, rgba(99,102,241,0.10), rgba(59,130,246,0.08)) !important;
|
| 274 |
-
}
|
| 275 |
-
/* Selected state - Gradio adds 'selected' class to the label in some versions, or we check input:checked */
|
| 276 |
-
.sidebar-nav label.selected {
|
| 277 |
-
border-color: rgba(99,102,241,0.35) !important;
|
| 278 |
-
box-shadow: inset 0 0 0 1px rgba(99,102,241,0.25), 0 1px 2px rgba(0,0,0,0.25) !important;
|
| 279 |
-
background: linear-gradient(180deg, rgba(99,102,241,0.18), rgba(59,130,246,0.14)) !important;
|
| 280 |
-
color: rgba(255, 255, 255, 0.95) !important;
|
| 281 |
-
}
|
| 282 |
-
|
| 283 |
-
/* Light theme adjustments for sidebar */
|
| 284 |
-
@media (prefers-color-scheme: light) {
|
| 285 |
-
.sidebar-nav label {
|
| 286 |
-
border-color: rgba(0, 0, 0, 0.08) !important;
|
| 287 |
-
background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.90)) !important;
|
| 288 |
-
color: rgba(0, 0, 0, 0.85) !important;
|
| 289 |
-
}
|
| 290 |
-
.sidebar-nav label:hover {
|
| 291 |
-
border-color: rgba(99,102,241,0.25) !important;
|
| 292 |
-
background: linear-gradient(180deg, rgba(99,102,241,0.08), rgba(59,130,246,0.06)) !important;
|
| 293 |
-
}
|
| 294 |
-
.sidebar-nav label.selected {
|
| 295 |
-
border-color: rgba(99,102,241,0.35) !important;
|
| 296 |
-
background: linear-gradient(180deg, rgba(99,102,241,0.16), rgba(59,130,246,0.12)) !important;
|
| 297 |
-
color: rgba(0, 0, 0, 0.85) !important;
|
| 298 |
-
}
|
| 299 |
-
}
|
| 300 |
-
|
| 301 |
-
/* Hide scrollbars/arrows that can appear on the description block in some browsers */
|
| 302 |
-
article.prose, .prose, .gr-prose {
|
| 303 |
-
overflow: visible !important;
|
| 304 |
-
max-height: none !important;
|
| 305 |
-
-ms-overflow-style: none !important; /* IE/Edge */
|
| 306 |
-
scrollbar-width: none !important; /* Firefox */
|
| 307 |
-
}
|
| 308 |
-
article.prose::-webkit-scrollbar,
|
| 309 |
-
.prose::-webkit-scrollbar,
|
| 310 |
-
.gr-prose::-webkit-scrollbar {
|
| 311 |
-
display: none !important; /* Chrome/Safari */
|
| 312 |
-
}
|
| 313 |
-
|
| 314 |
-
/* Fix for white background on single-line inputs in dark mode */
|
| 315 |
-
.gradio-container input[type="text"],
|
| 316 |
-
.gradio-container input[type="password"],
|
| 317 |
-
.gradio-container input[type="number"],
|
| 318 |
-
.gradio-container input[type="email"] {
|
| 319 |
-
background-color: var(--input-background-fill) !important;
|
| 320 |
-
color: var(--body-text-color) !important;
|
| 321 |
-
}
|
| 322 |
-
|
| 323 |
-
/* Custom glossy purple styling for primary action buttons */
|
| 324 |
-
.gradio-container button.primary {
|
| 325 |
-
border: 1px solid rgba(99, 102, 241, 0.35) !important;
|
| 326 |
-
background: linear-gradient(180deg, rgba(99, 102, 241, 0.25), rgba(59, 130, 246, 0.20)) !important;
|
| 327 |
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 4px rgba(0, 0, 0, 0.15) !important;
|
| 328 |
-
color: rgba(255, 255, 255, 0.95) !important;
|
| 329 |
-
transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .06s ease !important;
|
| 330 |
-
}
|
| 331 |
-
.gradio-container button.primary:hover {
|
| 332 |
-
border-color: rgba(99, 102, 241, 0.5) !important;
|
| 333 |
-
background: linear-gradient(180deg, rgba(99, 102, 241, 0.35), rgba(59, 130, 246, 0.28)) !important;
|
| 334 |
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 3px 6px rgba(0, 0, 0, 0.2) !important;
|
| 335 |
-
}
|
| 336 |
-
.gradio-container button.primary:active {
|
| 337 |
-
transform: scale(0.98) !important;
|
| 338 |
-
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1) !important;
|
| 339 |
-
}
|
| 340 |
-
@media (prefers-color-scheme: light) {
|
| 341 |
-
.gradio-container button.primary {
|
| 342 |
-
border-color: rgba(99, 102, 241, 0.4) !important;
|
| 343 |
-
background: linear-gradient(180deg, rgba(99, 102, 241, 0.85), rgba(79, 70, 229, 0.75)) !important;
|
| 344 |
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 4px rgba(0, 0, 0, 0.12) !important;
|
| 345 |
-
color: rgba(255, 255, 255, 0.98) !important;
|
| 346 |
-
}
|
| 347 |
-
.gradio-container button.primary:hover {
|
| 348 |
-
background: linear-gradient(180deg, rgba(99, 102, 241, 0.95), rgba(79, 70, 229, 0.85)) !important;
|
| 349 |
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 6px rgba(0, 0, 0, 0.15) !important;
|
| 350 |
-
}
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
/* Hide the actual tabs since we use the sidebar to control them */
|
| 354 |
-
.hidden-tabs .tab-nav,
|
| 355 |
-
.hidden-tabs [role="tablist"] {
|
| 356 |
-
display: none !important;
|
| 357 |
-
}
|
| 358 |
-
/* Hide the entire first row of the tabs container (contains tab buttons + overflow) */
|
| 359 |
-
.hidden-tabs > div:first-child {
|
| 360 |
-
display: none !important;
|
| 361 |
-
}
|
| 362 |
-
/* Ensure audio component buttons remain visible - they're inside tab panels, not the first row */
|
| 363 |
-
.hidden-tabs [role="tabpanel"] button {
|
| 364 |
-
display: inline-flex !important;
|
| 365 |
-
}
|
| 366 |
-
|
| 367 |
-
/* Custom scrollbar styling */
|
| 368 |
-
* {
|
| 369 |
-
scrollbar-width: thin;
|
| 370 |
-
scrollbar-color: rgba(61, 212, 159, 0.4) rgba(255, 255, 255, 0.05);
|
| 371 |
-
}
|
| 372 |
-
*::-webkit-scrollbar {
|
| 373 |
-
width: 8px;
|
| 374 |
-
height: 8px;
|
| 375 |
-
}
|
| 376 |
-
*::-webkit-scrollbar-track {
|
| 377 |
-
background: rgba(255, 255, 255, 0.05);
|
| 378 |
-
border-radius: 4px;
|
| 379 |
-
}
|
| 380 |
-
*::-webkit-scrollbar-thumb {
|
| 381 |
-
background: linear-gradient(180deg, rgba(61, 212, 159, 0.5), rgba(17, 186, 136, 0.4));
|
| 382 |
-
border-radius: 4px;
|
| 383 |
-
border: 1px solid rgba(119, 247, 209, 0.2);
|
| 384 |
-
}
|
| 385 |
-
*::-webkit-scrollbar-thumb:hover {
|
| 386 |
-
background: linear-gradient(180deg, rgba(85, 250, 192, 0.7), rgba(65, 184, 131, 0.6));
|
| 387 |
-
}
|
| 388 |
-
*::-webkit-scrollbar-corner {
|
| 389 |
-
background: rgba(255, 255, 255, 0.05);
|
| 390 |
-
}
|
| 391 |
-
@media (prefers-color-scheme: light) {
|
| 392 |
-
* {
|
| 393 |
-
scrollbar-color: rgba(61, 212, 159, 0.4) rgba(0, 0, 0, 0.05);
|
| 394 |
-
}
|
| 395 |
-
*::-webkit-scrollbar-track {
|
| 396 |
-
background: rgba(0, 0, 0, 0.05);
|
| 397 |
-
}
|
| 398 |
-
*::-webkit-scrollbar-thumb {
|
| 399 |
-
background: linear-gradient(180deg, rgba(61, 212, 159, 0.5), rgba(17, 186, 136, 0.4));
|
| 400 |
-
border-color: rgba(0, 0, 0, 0.1);
|
| 401 |
-
}
|
| 402 |
-
*::-webkit-scrollbar-thumb:hover {
|
| 403 |
-
background: linear-gradient(180deg, rgba(85, 250, 192, 0.7), rgba(65, 184, 131, 0.6));
|
| 404 |
-
}
|
| 405 |
-
*::-webkit-scrollbar-corner {
|
| 406 |
-
background: rgba(0, 0, 0, 0.05);
|
| 407 |
-
}
|
| 408 |
-
}
|
| 409 |
-
"""
|
| 410 |
|
| 411 |
# Build each tab interface using modular builders
|
| 412 |
fetch_interface = build_fetch_interface()
|
|
|
|
| 100 |
HF_VIDEO_TOKEN = bool(os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN"))
|
| 101 |
HF_TEXTGEN_TOKEN = bool(os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN"))
|
| 102 |
|
| 103 |
+
# Load CSS from external file
|
| 104 |
+
_css_path = os.path.join(os.path.dirname(__file__), "styles.css")
|
| 105 |
+
with open(_css_path, "r", encoding="utf-8") as _css_file:
|
| 106 |
+
CSS_STYLES = _css_file.read()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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