Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -158,38 +158,287 @@ def process_video(
|
|
| 158 |
|
| 159 |
# Create the Gradio interface
|
| 160 |
with gr.Blocks(css="""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
.chatbot {
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
| 165 |
}
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
.
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
|
|
|
| 184 |
.gr-button-primary:hover {
|
| 185 |
-
background:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
}
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
| 159 |
# Create the Gradio interface
|
| 160 |
with gr.Blocks(css="""
|
| 161 |
+
/* Apple-inspired design system */
|
| 162 |
+
:root {
|
| 163 |
+
--apple-blue: #0071e3;
|
| 164 |
+
--apple-blue-hover: #0077ed;
|
| 165 |
+
--apple-gray-1: #fbfbfd;
|
| 166 |
+
--apple-gray-2: #f5f5f7;
|
| 167 |
+
--apple-gray-3: #e8e8ed;
|
| 168 |
+
--apple-gray-4: #d2d2d7;
|
| 169 |
+
--apple-gray-5: #86868b;
|
| 170 |
+
--apple-gray-6: #515154;
|
| 171 |
+
--apple-text: #1d1d1f;
|
| 172 |
+
--apple-bg: #ffffff;
|
| 173 |
+
--apple-radius: 12px;
|
| 174 |
+
--apple-radius-sm: 8px;
|
| 175 |
+
--apple-radius-lg: 18px;
|
| 176 |
+
--apple-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
|
| 177 |
+
--apple-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
|
| 178 |
+
--apple-shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/* Global styles */
|
| 182 |
+
.gradio-container {
|
| 183 |
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
| 184 |
+
background: var(--apple-gray-1);
|
| 185 |
+
color: var(--apple-text);
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
/* Main container */
|
| 189 |
+
.contain {
|
| 190 |
+
max-width: 1400px !important;
|
| 191 |
+
margin: 0 auto;
|
| 192 |
+
padding: 24px;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/* Headers */
|
| 196 |
+
h1, h2, h3 {
|
| 197 |
+
font-weight: 600;
|
| 198 |
+
letter-spacing: -0.02em;
|
| 199 |
+
color: var(--apple-text);
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
h1 {
|
| 203 |
+
font-size: 48px;
|
| 204 |
+
font-weight: 700;
|
| 205 |
+
background: linear-gradient(135deg, #1d1d1f 0%, #515154 100%);
|
| 206 |
+
-webkit-background-clip: text;
|
| 207 |
+
-webkit-text-fill-color: transparent;
|
| 208 |
+
margin-bottom: 8px;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
/* Chatbot styling */
|
| 212 |
.chatbot {
|
| 213 |
+
background: var(--apple-bg) !important;
|
| 214 |
+
border-radius: var(--apple-radius) !important;
|
| 215 |
+
border: 1px solid var(--apple-gray-3) !important;
|
| 216 |
+
box-shadow: var(--apple-shadow-md) !important;
|
| 217 |
+
overflow: hidden;
|
| 218 |
}
|
| 219 |
+
|
| 220 |
+
.message-wrap {
|
| 221 |
+
padding: 12px 16px !important;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.message {
|
| 225 |
+
font-size: 15px !important;
|
| 226 |
+
line-height: 1.5 !important;
|
| 227 |
+
max-width: 85% !important;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
.user .message {
|
| 231 |
+
background: var(--apple-blue) !important;
|
| 232 |
+
color: white !important;
|
| 233 |
+
border-radius: var(--apple-radius-lg) !important;
|
| 234 |
+
padding: 10px 16px !important;
|
| 235 |
+
margin-left: auto !important;
|
| 236 |
+
box-shadow: var(--apple-shadow-sm) !important;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
.bot .message {
|
| 240 |
+
background: var(--apple-gray-2) !important;
|
| 241 |
+
color: var(--apple-text) !important;
|
| 242 |
+
border-radius: var(--apple-radius-lg) !important;
|
| 243 |
+
padding: 10px 16px !important;
|
| 244 |
+
box-shadow: var(--apple-shadow-sm) !important;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
/* Buttons */
|
| 248 |
+
.gr-button {
|
| 249 |
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif !important;
|
| 250 |
+
font-weight: 500 !important;
|
| 251 |
+
border-radius: var(--apple-radius-sm) !important;
|
| 252 |
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 253 |
+
border: none !important;
|
| 254 |
+
box-shadow: var(--apple-shadow-sm) !important;
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
.gr-button-primary, .gr-button-primary:hover {
|
| 258 |
+
background: var(--apple-blue) !important;
|
| 259 |
+
color: white !important;
|
| 260 |
+
font-size: 16px !important;
|
| 261 |
+
padding: 12px 24px !important;
|
| 262 |
+
letter-spacing: -0.01em !important;
|
| 263 |
}
|
| 264 |
+
|
| 265 |
.gr-button-primary:hover {
|
| 266 |
+
background: var(--apple-blue-hover) !important;
|
| 267 |
+
transform: translateY(-1px) !important;
|
| 268 |
+
box-shadow: var(--apple-shadow-md) !important;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
.gr-button-primary:active {
|
| 272 |
+
transform: translateY(0) !important;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
/* Video component */
|
| 276 |
+
.gr-video {
|
| 277 |
+
border-radius: var(--apple-radius) !important;
|
| 278 |
+
overflow: hidden !important;
|
| 279 |
+
box-shadow: var(--apple-shadow-lg) !important;
|
| 280 |
+
border: 1px solid var(--apple-gray-3) !important;
|
| 281 |
+
background: var(--apple-text) !important;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
video {
|
| 285 |
+
border-radius: var(--apple-radius) !important;
|
| 286 |
}
|
| 287 |
+
|
| 288 |
+
/* Sidebar */
|
| 289 |
+
.gr-sidebar {
|
| 290 |
+
background: var(--apple-bg) !important;
|
| 291 |
+
border-radius: var(--apple-radius) !important;
|
| 292 |
+
border: 1px solid var(--apple-gray-3) !important;
|
| 293 |
+
box-shadow: var(--apple-shadow-md) !important;
|
| 294 |
+
padding: 20px !important;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
/* Accordion */
|
| 298 |
.gr-accordion {
|
| 299 |
+
background: var(--apple-gray-2) !important;
|
| 300 |
+
border-radius: var(--apple-radius-sm) !important;
|
| 301 |
+
border: 1px solid var(--apple-gray-3) !important;
|
| 302 |
+
overflow: hidden !important;
|
| 303 |
+
margin-top: 16px !important;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
.gr-accordion-header {
|
| 307 |
+
background: var(--apple-gray-2) !important;
|
| 308 |
+
padding: 12px 16px !important;
|
| 309 |
+
font-weight: 500 !important;
|
| 310 |
+
color: var(--apple-text) !important;
|
| 311 |
+
border: none !important;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
.gr-accordion-header:hover {
|
| 315 |
+
background: var(--apple-gray-3) !important;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
/* Gallery */
|
| 319 |
+
.gr-gallery {
|
| 320 |
+
background: transparent !important;
|
| 321 |
+
gap: 12px !important;
|
| 322 |
}
|
| 323 |
+
|
| 324 |
+
.gr-gallery-item {
|
| 325 |
+
border-radius: var(--apple-radius-sm) !important;
|
| 326 |
+
overflow: hidden !important;
|
| 327 |
+
box-shadow: var(--apple-shadow-sm) !important;
|
| 328 |
+
border: 1px solid var(--apple-gray-3) !important;
|
| 329 |
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.gr-gallery-item:hover {
|
| 333 |
+
transform: scale(1.02) !important;
|
| 334 |
+
box-shadow: var(--apple-shadow-md) !important;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
/* Progress bar */
|
| 338 |
+
.progress-bar {
|
| 339 |
+
background: var(--apple-gray-3) !important;
|
| 340 |
+
border-radius: 100px !important;
|
| 341 |
+
overflow: hidden !important;
|
| 342 |
+
height: 4px !important;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
.progress-bar-fill {
|
| 346 |
+
background: var(--apple-blue) !important;
|
| 347 |
+
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
/* Labels */
|
| 351 |
+
label {
|
| 352 |
+
color: var(--apple-gray-5) !important;
|
| 353 |
+
font-size: 13px !important;
|
| 354 |
+
font-weight: 500 !important;
|
| 355 |
+
letter-spacing: -0.01em !important;
|
| 356 |
+
margin-bottom: 6px !important;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
/* Inputs and form elements */
|
| 360 |
+
.gr-input, .gr-textbox, .gr-dropdown {
|
| 361 |
+
background: var(--apple-bg) !important;
|
| 362 |
+
border: 1px solid var(--apple-gray-4) !important;
|
| 363 |
+
border-radius: var(--apple-radius-sm) !important;
|
| 364 |
+
padding: 10px 12px !important;
|
| 365 |
+
font-size: 15px !important;
|
| 366 |
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
.gr-input:focus, .gr-textbox:focus, .gr-dropdown:focus {
|
| 370 |
+
border-color: var(--apple-blue) !important;
|
| 371 |
+
box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1) !important;
|
| 372 |
+
outline: none !important;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
/* Markdown content */
|
| 376 |
.gr-markdown {
|
| 377 |
+
color: var(--apple-text) !important;
|
| 378 |
+
line-height: 1.6 !important;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
.gr-markdown h2 {
|
| 382 |
+
font-size: 20px !important;
|
| 383 |
+
font-weight: 600 !important;
|
| 384 |
+
margin-bottom: 12px !important;
|
| 385 |
+
color: var(--apple-text) !important;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
/* Loading states */
|
| 389 |
+
.gr-loading {
|
| 390 |
+
color: var(--apple-gray-5) !important;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
/* Scrollbars */
|
| 394 |
+
::-webkit-scrollbar {
|
| 395 |
+
width: 8px;
|
| 396 |
+
height: 8px;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
::-webkit-scrollbar-track {
|
| 400 |
+
background: var(--apple-gray-2);
|
| 401 |
+
border-radius: 10px;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
::-webkit-scrollbar-thumb {
|
| 405 |
+
background: var(--apple-gray-4);
|
| 406 |
+
border-radius: 10px;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
::-webkit-scrollbar-thumb:hover {
|
| 410 |
+
background: var(--apple-gray-5);
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
/* Animations */
|
| 414 |
+
@keyframes fadeIn {
|
| 415 |
+
from {
|
| 416 |
+
opacity: 0;
|
| 417 |
+
transform: translateY(10px);
|
| 418 |
+
}
|
| 419 |
+
to {
|
| 420 |
+
opacity: 1;
|
| 421 |
+
transform: translateY(0);
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
.message {
|
| 426 |
+
animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
/* Responsive adjustments */
|
| 430 |
+
@media (max-width: 768px) {
|
| 431 |
+
h1 {
|
| 432 |
+
font-size: 36px;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
.contain {
|
| 436 |
+
padding: 16px;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
.message {
|
| 440 |
+
max-width: 90% !important;
|
| 441 |
+
}
|
| 442 |
}
|
| 443 |
""") as demo:
|
| 444 |
gr.Markdown("# 🎬 FastVLM Video Captioning")
|