akhaliq HF Staff commited on
Commit
0b5b849
·
1 Parent(s): 57dac98

feat: implement dashboard layout and styling with updated color palette and sidebar components

Browse files
Files changed (1) hide show
  1. index.html +336 -453
index.html CHANGED
@@ -3,592 +3,500 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>OmniShotCut | AI Shot Boundary Detection</title>
7
  <link rel="preconnect" href="https://fonts.googleapis.com">
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
 
10
  <style>
11
  :root {
 
 
 
 
12
  --primary: #8b5cf6;
13
- --primary-hover: #7c3aed;
14
- --bg: #09090b;
15
- --card-bg: #18181b;
16
- --border: #27272a;
17
- --text: #fafafa;
18
- --text-muted: #a1a1aa;
19
- --accent: #d4d4d8;
20
- --glass: rgba(24, 24, 27, 0.8);
21
- --glass-border: rgba(255, 255, 255, 0.1);
22
  }
23
 
24
  * {
25
  box-sizing: border-box;
26
  margin: 0;
27
  padding: 0;
 
 
28
  }
29
 
 
 
 
 
 
30
  body {
31
  font-family: 'Inter', sans-serif;
32
- background-color: var(--bg);
33
- color: var(--text);
34
- line-height: 1.5;
35
- -webkit-font-smoothing: antialiased;
36
- overflow-x: hidden;
37
- }
38
-
39
- .container {
40
- max-width: 1200px;
41
- margin: 0 auto;
42
- padding: 2rem;
43
  }
44
 
 
45
  header {
 
 
 
46
  display: flex;
47
- justify-content: space-between;
48
  align-items: center;
49
- padding: 1.5rem 0;
50
- border-bottom: 1px solid var(--border);
51
- margin-bottom: 3rem;
52
- position: sticky;
53
- top: 0;
54
- background: var(--glass);
55
- backdrop-filter: blur(12px);
56
  z-index: 100;
57
- width: 100%;
58
  }
59
 
60
- .header-content {
61
- max-width: 1200px;
62
- margin: 0 auto;
63
- width: 100%;
64
  display: flex;
65
- justify-content: space-between;
66
  align-items: center;
67
- padding: 0 2rem;
68
- }
69
-
70
- .logo {
71
- font-size: 1.5rem;
72
  font-weight: 700;
73
- letter-spacing: -0.025em;
74
- background: linear-gradient(to right, #a78bfa, #8b5cf6);
75
- -webkit-background-clip: text;
76
- -webkit-text-fill-color: transparent;
77
- }
78
-
79
- .nav-links a {
80
- color: var(--text-muted);
81
- text-decoration: none;
82
- font-size: 0.875rem;
83
- margin-left: 1.5rem;
84
- transition: color 0.2s;
85
- }
86
-
87
- .nav-links a:hover {
88
- color: var(--text);
89
- }
90
-
91
- .hero {
92
- text-align: center;
93
- margin-bottom: 4rem;
94
- animation: fadeIn 0.8s ease-out;
95
- }
96
-
97
- .hero h1 {
98
- font-size: 3.5rem;
99
- font-weight: 800;
100
- margin-bottom: 1rem;
101
- letter-spacing: -0.05em;
102
  }
103
 
104
- .hero p {
105
- font-size: 1.25rem;
106
- color: var(--text-muted);
107
- max-width: 700px;
108
- margin: 0 auto;
109
- }
110
 
111
- @keyframes fadeIn {
112
- from { opacity: 0; transform: translateY(20px); }
113
- to { opacity: 1; transform: translateY(0); }
114
- }
115
-
116
- .main-grid {
117
- display: grid;
118
- grid-template-columns: 1fr 1fr;
119
- gap: 2rem;
120
- margin-bottom: 4rem;
121
  }
122
 
123
- @media (max-width: 1024px) {
124
- .main-grid {
125
- grid-template-columns: 1fr;
126
- }
 
 
 
 
127
  }
128
 
129
- .card {
130
- background: var(--card-bg);
131
- border: 1px solid var(--border);
132
- border-radius: 1rem;
133
- padding: 1.5rem;
134
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
135
- transition: transform 0.2s, box-shadow 0.2s;
 
 
 
136
  }
137
 
138
- .card:hover {
139
- box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
 
 
140
  }
141
 
142
- .upload-area {
143
  border: 2px dashed var(--border);
144
- border-radius: 0.75rem;
145
- padding: 3rem;
146
  text-align: center;
147
  cursor: pointer;
148
- transition: border-color 0.2s, background 0.2s;
149
- position: relative;
150
  }
151
 
152
- .upload-area:hover, .upload-area.dragging {
153
  border-color: var(--primary);
154
- background: rgba(139, 92, 246, 0.05);
155
  }
156
 
157
- .upload-icon {
158
- width: 48px;
159
- height: 48px;
160
- margin-bottom: 1rem;
161
- color: var(--text-muted);
162
- }
163
 
164
- .upload-area p {
165
- margin-bottom: 0.5rem;
 
 
166
  }
167
 
168
- .upload-area span {
169
- font-size: 0.875rem;
170
- color: var(--text-muted);
 
 
 
 
171
  }
172
 
173
- #video-input {
174
- display: none;
175
- }
176
 
177
- .preview-video {
178
- width: 100%;
179
- border-radius: 0.5rem;
180
- margin-top: 1rem;
181
- display: none;
182
  background: #000;
183
- }
184
-
185
- .btn {
186
- display: inline-flex;
187
  align-items: center;
188
  justify-content: center;
189
- padding: 0.75rem 1.5rem;
190
- border-radius: 0.5rem;
191
- font-weight: 600;
192
- font-size: 0.875rem;
193
- cursor: pointer;
194
- transition: all 0.2s;
195
- border: none;
196
- width: 100%;
197
- margin-top: 1rem;
198
- }
199
-
200
- .btn-primary {
201
- background: var(--primary);
202
- color: white;
203
  }
204
 
205
- .btn-primary:hover:not(:disabled) {
206
- background: var(--primary-hover);
207
- transform: translateY(-1px);
 
 
 
 
 
 
208
  }
209
 
210
- .btn-primary:disabled {
211
- opacity: 0.5;
212
- cursor: not-allowed;
213
- }
214
 
215
- .results-section {
216
- display: none;
217
- animation: fadeIn 0.5s ease-out;
 
218
  }
219
 
220
- .section-title {
221
- font-size: 1.25rem;
222
- font-weight: 700;
223
- margin-bottom: 1.5rem;
 
 
 
 
 
 
224
  display: flex;
225
  align-items: center;
226
  gap: 0.5rem;
 
227
  }
228
 
229
- .gallery-grid {
230
- display: grid;
231
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
232
- gap: 1rem;
233
- margin-bottom: 2rem;
234
- }
235
 
236
- .gallery-item {
237
- position: relative;
238
- aspect-ratio: 16/9;
239
- border-radius: 0.5rem;
 
 
 
240
  overflow: hidden;
241
- border: 1px solid var(--border);
242
- cursor: pointer;
243
- transition: transform 0.2s;
244
- }
245
-
246
- .gallery-item:hover {
247
- transform: scale(1.02);
248
- border-color: var(--primary);
249
  }
250
 
251
- .gallery-item img {
252
- width: 100%;
253
- height: 100%;
254
- object-fit: cover;
255
  }
256
 
257
- .table-container {
258
- width: 100%;
259
- overflow-x: auto;
260
- border: 1px solid var(--border);
261
- border-radius: 0.75rem;
262
- background: var(--card-bg);
 
 
 
 
 
263
  }
 
 
264
 
265
- /* Result table styling override */
266
- .result-table-wrap {
267
- width: 100%;
268
- max-height: 500px;
269
- overflow: auto;
 
 
 
270
  }
271
 
272
- .result-table {
273
- width: 100%;
274
- border-collapse: collapse;
275
- font-size: 14px;
276
- color: var(--text);
 
 
 
 
277
  }
278
 
279
- .result-table th {
280
- position: sticky;
281
- top: 0;
282
- background: #27272a;
283
- border-bottom: 1px solid var(--border);
284
- padding: 12px 16px;
285
- text-align: left;
286
- font-weight: 600;
287
- color: var(--text-muted);
 
288
  }
289
 
290
- .result-table td {
291
- border-bottom: 1px solid var(--border);
292
- padding: 12px 16px;
293
  }
294
 
295
- .result-table tr:hover {
296
- background: rgba(255, 255, 255, 0.02);
 
 
 
 
 
 
 
 
297
  }
298
 
299
- .loading-overlay {
 
300
  position: fixed;
301
- top: 0;
302
- left: 0;
303
- width: 100%;
304
- height: 100%;
305
- background: rgba(0, 0, 0, 0.8);
306
  display: none;
307
  flex-direction: column;
308
  align-items: center;
309
  justify-content: center;
310
- z-index: 1000;
311
- backdrop-filter: blur(4px);
312
  }
313
 
314
  .spinner {
315
- width: 40px;
316
- height: 40px;
317
- border: 4px solid rgba(255, 255, 255, 0.1);
318
- border-left-color: var(--primary);
319
  border-radius: 50%;
320
  animation: spin 1s linear infinite;
321
- margin-bottom: 1rem;
322
- }
323
-
324
- @keyframes spin {
325
- to { transform: rotate(360deg); }
326
- }
327
-
328
- .examples-section {
329
- margin-top: 4rem;
330
- padding-top: 2rem;
331
- border-top: 1px solid var(--border);
332
- }
333
-
334
- .examples-grid {
335
- display: grid;
336
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
337
- gap: 1.5rem;
338
- margin-top: 1.5rem;
339
- }
340
-
341
- .example-item {
342
- cursor: pointer;
343
- border-radius: 0.75rem;
344
- overflow: hidden;
345
- border: 1px solid var(--border);
346
- transition: all 0.2s;
347
- position: relative;
348
- }
349
-
350
- .example-item:hover {
351
- border-color: var(--primary);
352
- transform: translateY(-4px);
353
  }
354
 
355
- .example-item video {
356
- width: 100%;
357
- display: block;
358
- }
359
-
360
- .example-label {
361
- padding: 0.75rem;
362
- font-size: 0.875rem;
363
- font-weight: 500;
364
- text-align: center;
365
- background: var(--card-bg);
366
- }
367
-
368
- footer {
369
- margin-top: 8rem;
370
- padding: 4rem 0;
371
- border-top: 1px solid var(--border);
372
- text-align: center;
373
- color: var(--text-muted);
374
- font-size: 0.875rem;
375
- }
376
 
377
- /* Modal for full size visualization */
378
  .modal {
379
- display: none;
380
  position: fixed;
381
- top: 0;
382
- left: 0;
383
- width: 100%;
384
- height: 100%;
385
- background: rgba(0, 0, 0, 0.95);
386
  z-index: 2000;
387
- justify-content: center;
388
  align-items: center;
 
389
  padding: 2rem;
390
  }
391
 
392
- .modal-content {
393
- max-width: 100%;
394
- max-height: 100%;
395
- object-fit: contain;
396
- }
397
 
398
- .close-modal {
399
- position: absolute;
400
- top: 2rem;
401
- right: 2rem;
402
- color: white;
403
- font-size: 2rem;
404
- cursor: pointer;
 
 
 
405
  }
406
  </style>
407
  </head>
408
  <body>
409
 
410
  <header>
411
- <div class="header-content">
412
- <div class="logo">OmniShotCut</div>
413
- <nav class="nav-links">
414
- <a href="https://arxiv.org/abs/2604.24762" target="_blank">arXiv</a>
415
- <a href="https://uva-computer-vision-lab.github.io/OmniShotCut_website/" target="_blank">Project</a>
416
- <a href="https://github.com/UVA-Computer-Vision-Lab/OmniShotCut" target="_blank">GitHub</a>
417
- </nav>
 
 
418
  </div>
419
  </header>
420
 
421
- <div class="container">
422
- <section class="hero">
423
- <h1>Relational Shot Detection</h1>
424
- <p>State-of-the-art shot boundary detection using Shot-Query Transformer. Analyze videos with holistic temporal understanding.</p>
425
- </section>
426
-
427
- <div class="main-grid">
428
- <div class="card">
429
- <div class="section-title">
430
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
431
- Upload Video
432
- </div>
433
- <div class="upload-area" id="drop-zone">
434
- <svg class="upload-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"/><line x1="7" y1="2" x2="7" y2="22"/><line x1="17" y1="2" x2="17" y2="22"/><line x1="2" y1="12" x2="22" y2="12"/><line x1="2" y1="7" x2="7" y2="7"/><line x1="2" y1="17" x2="7" y2="17"/><line x1="17" y1="17" x2="22" y2="17"/><line x1="17" y1="7" x2="22" y2="7"/></svg>
435
- <p>Drag & drop or click to upload</p>
436
- <span>Supports MP4, AVI, MOV</span>
437
- <input type="file" id="video-input" accept="video/*">
438
- </div>
439
- <video id="preview-video" class="preview-video" controls></video>
440
- <button id="run-btn" class="btn btn-primary" disabled>Run Inference</button>
441
- </div>
442
-
443
- <div class="card">
444
- <div class="section-title">
445
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>
446
- How it works
447
- </div>
448
- <p style="color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem;">
449
- OmniShotCut uses a Transformer-based architecture to detect shot boundaries by considering the relationships between all frames in a segment, rather than just local changes.
450
- </p>
451
- <ul style="color: var(--text-muted); font-size: 0.9rem; margin-left: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem;">
452
- <li>High sensitivity to subtle transitions</li>
453
- <li>Holistic relational modeling</li>
454
- <li>Support for complex intra/inter label classification</li>
455
- <li>Efficient ZeroGPU inference</li>
456
- </ul>
457
- </div>
458
  </div>
459
-
460
- <section id="results" class="results-section">
461
- <div class="section-title">
462
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/></svg>
463
- Inference Results <span id="shot-badge" style="background: var(--primary); padding: 2px 8px; border-radius: 99px; font-size: 0.75rem; margin-left: 0.5rem;">0 Shots</span>
464
  </div>
465
 
466
- <h3 style="margin-bottom: 1rem; font-size: 1rem; color: var(--text-muted);">Visualization</h3>
467
- <div class="gallery-grid" id="gallery">
468
- <!-- Gallery items will be injected here -->
469
  </div>
470
-
471
- <h3 style="margin-bottom: 1rem; font-size: 1rem; color: var(--text-muted);">Detailed Shot List</h3>
472
- <div id="table-container" class="table-container">
473
- <!-- Table will be injected here -->
 
 
 
 
 
474
  </div>
475
- </section>
 
 
 
 
 
 
 
 
476
 
477
- <section class="examples-section">
478
- <div class="section-title">Try Examples</div>
479
- <div class="examples-grid" id="examples-grid">
480
- <!-- Examples will be injected here -->
 
 
 
 
481
  </div>
482
- </section>
 
483
 
484
- <footer>
485
- <p>&copy; 2026 OmniShotCut. Built with Gradio Server & FastAPI.</p>
486
- </footer>
487
- </div>
 
 
 
 
 
 
 
488
 
489
- <div class="loading-overlay" id="loader">
490
  <div class="spinner"></div>
491
- <p id="loading-text">Processing video...</p>
492
  </div>
493
 
494
  <div class="modal" id="modal">
495
- <span class="close-modal">&times;</span>
496
  <img class="modal-content" id="modal-img">
497
  </div>
498
 
499
  <script type="module">
500
  import { Client, handle_file } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
501
 
 
 
 
502
  const dropZone = document.getElementById('drop-zone');
503
  const videoInput = document.getElementById('video-input');
504
- const previewVideo = document.getElementById('preview-video');
 
505
  const runBtn = document.getElementById('run-btn');
506
  const loader = document.getElementById('loader');
507
- const resultsSection = document.getElementById('results');
508
  const gallery = document.getElementById('gallery');
509
  const tableContainer = document.getElementById('table-container');
510
- const shotBadge = document.getElementById('shot-badge');
511
  const modal = document.getElementById('modal');
512
  const modalImg = document.getElementById('modal-img');
513
  const examplesGrid = document.getElementById('examples-grid');
 
514
 
515
  let selectedFile = null;
516
  let client = null;
517
 
518
- // Initialize Gradio Client
519
  async function initClient() {
520
  client = await Client.connect(window.location.origin);
521
- console.log("Gradio Client Connected");
 
522
  }
523
  initClient();
524
 
525
- // Handle File Selection
526
  dropZone.onclick = () => videoInput.click();
527
-
528
- videoInput.onchange = (e) => {
529
- const file = e.target.files[0];
530
- if (file) handleFile(file);
531
- };
532
-
533
- dropZone.ondragover = (e) => {
534
- e.preventDefault();
535
- dropZone.classList.add('dragging');
536
- };
537
-
538
- dropZone.ondragleave = () => {
539
- dropZone.classList.remove('dragging');
540
- };
541
-
542
- dropZone.ondrop = (e) => {
543
- e.preventDefault();
544
- dropZone.classList.remove('dragging');
545
- const file = e.dataTransfer.files[0];
546
- if (file) handleFile(file);
547
- };
548
 
549
  function handleFile(file) {
 
550
  selectedFile = file;
551
- const url = URL.createObjectURL(file);
552
- previewVideo.src = url;
553
- previewVideo.style.display = 'block';
554
- dropZone.style.display = 'none';
555
  runBtn.disabled = false;
556
  }
557
 
558
- // Run Inference
559
  runBtn.onclick = async () => {
560
  if (!selectedFile || !client) return;
561
 
562
  loader.style.display = 'flex';
563
- resultsSection.style.display = 'none';
564
-
565
  try {
566
  const result = await client.predict("/run_inference", {
567
  video_file: handle_file(selectedFile)
568
  });
569
-
570
- const data = result.data[0];
571
- renderResults(data);
572
- } catch (error) {
573
- console.error("Inference failed:", error);
574
- alert("Inference failed. Check console for details.");
575
  } finally {
576
  loader.style.display = 'none';
577
  }
578
  };
579
 
580
  function renderResults(data) {
581
- resultsSection.style.display = 'block';
582
- shotBadge.innerText = `${data.shot_count} Shots`;
 
 
583
 
584
- // Render Gallery
 
 
585
  gallery.innerHTML = '';
586
- data.gallery.forEach(file => {
587
  const item = document.createElement('div');
588
- item.className = 'gallery-item';
589
  const img = document.createElement('img');
590
  img.src = file.url;
 
 
 
 
 
591
  item.appendChild(img);
 
 
592
  item.onclick = () => {
593
  modalImg.src = file.url;
594
  modal.style.display = 'flex';
@@ -596,29 +504,20 @@
596
  gallery.appendChild(item);
597
  });
598
 
599
- // Render Table
600
  tableContainer.innerHTML = data.table;
601
-
602
- // Scroll to results
603
- resultsSection.scrollIntoView({ behavior: 'smooth' });
604
  }
605
 
606
- // Modal close
607
- document.querySelector('.close-modal').onclick = () => {
608
- modal.style.display = 'none';
609
- };
610
-
611
- // Fetch examples from backend
612
  async function loadExamples() {
613
  try {
614
- // We'll expose an API for examples too
615
  const result = await client.predict("/get_examples", {});
616
  const examples = result.data[0];
617
-
618
  examplesGrid.innerHTML = '';
 
619
  examples.forEach(ex => {
620
- const item = document.createElement('div');
621
- item.className = 'example-item';
622
 
623
  const video = document.createElement('video');
624
  video.src = ex.url;
@@ -626,44 +525,28 @@
626
  video.preload = "metadata";
627
  video.onloadedmetadata = () => video.currentTime = 0.1;
628
 
629
- video.onmouseover = () => video.play();
630
- video.onmouseout = () => { video.pause(); video.currentTime = 0.1; };
631
 
632
- const label = document.createElement('div');
633
- label.className = 'example-label';
634
- label.innerText = ex.orig_name || 'Example';
635
 
636
- item.appendChild(video);
637
- item.appendChild(label);
638
 
639
- item.onclick = async () => {
640
- try {
641
- const response = await fetch(ex.url);
642
- if (!response.ok) throw new Error("Fetch failed");
643
-
644
- const blob = await response.blob();
645
- if (blob.size < 1000) {
646
- alert("Warning: This file appears to be a Git LFS pointer and not a real video. Please check your Space's LFS settings.");
647
- }
648
-
649
- const file = new File([blob], ex.orig_name || 'example.mp4', { type: 'video/mp4' });
650
- handleFile(file);
651
- window.scrollTo({ top: dropZone.offsetTop - 100, behavior: 'smooth' });
652
- } catch (err) {
653
- console.error(err);
654
- alert("Failed to load example video. It may be missing from the server.");
655
- }
656
  };
657
 
658
- examplesGrid.appendChild(item);
659
  });
660
- } catch (e) {
661
- console.log("No examples found or API missing");
662
- }
663
  }
664
-
665
- // Wait a bit for client to connect then load examples
666
- setTimeout(loadExamples, 1000);
667
 
668
  </script>
669
  </body>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>OmniShotCut Pro | Shot Boundary Detection</title>
7
  <link rel="preconnect" href="https://fonts.googleapis.com">
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
10
+ <script src="https://unpkg.com/lucide@latest"></script>
11
  <style>
12
  :root {
13
+ --bg-base: #0c0c0e;
14
+ --bg-surface: #141417;
15
+ --bg-elevated: #1c1c21;
16
+ --border: #2a2a2f;
17
  --primary: #8b5cf6;
18
+ --primary-muted: rgba(139, 92, 246, 0.2);
19
+ --text-main: #efeff1;
20
+ --text-dim: #94949e;
21
+ --accent-green: #10b981;
22
+ --header-height: 48px;
23
+ --sidebar-width: 280px;
24
+ --inspector-width: 320px;
25
+ --timeline-height: 240px;
 
26
  }
27
 
28
  * {
29
  box-sizing: border-box;
30
  margin: 0;
31
  padding: 0;
32
+ scrollbar-width: thin;
33
+ scrollbar-color: var(--border) transparent;
34
  }
35
 
36
+ ::-webkit-scrollbar { width: 6px; height: 6px; }
37
+ ::-webkit-scrollbar-track { background: transparent; }
38
+ ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
39
+ ::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
40
+
41
  body {
42
  font-family: 'Inter', sans-serif;
43
+ background-color: var(--bg-base);
44
+ color: var(--text-main);
45
+ height: 100vh;
46
+ display: grid;
47
+ grid-template-rows: var(--header-height) 1fr var(--timeline-height);
48
+ grid-template-columns: var(--sidebar-width) 1fr var(--inspector-width);
49
+ grid-template-areas:
50
+ "header header header"
51
+ "media preview inspector"
52
+ "timeline timeline timeline";
53
+ overflow: hidden;
54
  }
55
 
56
+ /* --- Header --- */
57
  header {
58
+ grid-area: header;
59
+ background: var(--bg-surface);
60
+ border-bottom: 1px solid var(--border);
61
  display: flex;
 
62
  align-items: center;
63
+ justify-content: space-between;
64
+ padding: 0 1rem;
 
 
 
 
 
65
  z-index: 100;
 
66
  }
67
 
68
+ .brand {
 
 
 
69
  display: flex;
 
70
  align-items: center;
71
+ gap: 0.75rem;
 
 
 
 
72
  font-weight: 700;
73
+ font-size: 0.9rem;
74
+ letter-spacing: -0.01em;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
 
77
+ .brand svg { color: var(--primary); }
 
 
 
 
 
78
 
79
+ .header-actions {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 1rem;
 
 
 
 
 
 
83
  }
84
 
85
+ /* --- Media Sidebar --- */
86
+ .sidebar {
87
+ grid-area: media;
88
+ background: var(--bg-surface);
89
+ border-right: 1px solid var(--border);
90
+ display: flex;
91
+ flex-direction: column;
92
+ overflow: hidden;
93
  }
94
 
95
+ .panel-header {
96
+ padding: 0.75rem 1rem;
97
+ font-size: 0.75rem;
98
+ font-weight: 600;
99
+ text-transform: uppercase;
100
+ color: var(--text-dim);
101
+ border-bottom: 1px solid var(--border);
102
+ display: flex;
103
+ justify-content: space-between;
104
+ align-items: center;
105
  }
106
 
107
+ .media-content {
108
+ flex: 1;
109
+ overflow-y: auto;
110
+ padding: 1rem;
111
  }
112
 
113
+ .upload-card {
114
  border: 2px dashed var(--border);
115
+ border-radius: 0.5rem;
116
+ padding: 1.5rem 1rem;
117
  text-align: center;
118
  cursor: pointer;
119
+ transition: all 0.2s;
120
+ margin-bottom: 1.5rem;
121
  }
122
 
123
+ .upload-card:hover {
124
  border-color: var(--primary);
125
+ background: var(--primary-muted);
126
  }
127
 
128
+ .upload-card i { margin-bottom: 0.5rem; color: var(--text-dim); }
129
+ .upload-card p { font-size: 0.8rem; font-weight: 500; }
 
 
 
 
130
 
131
+ .examples-list {
132
+ display: flex;
133
+ flex-direction: column;
134
+ gap: 0.75rem;
135
  }
136
 
137
+ .example-node {
138
+ background: var(--bg-elevated);
139
+ border: 1px solid var(--border);
140
+ border-radius: 0.4rem;
141
+ overflow: hidden;
142
+ cursor: pointer;
143
+ transition: border-color 0.2s;
144
  }
145
 
146
+ .example-node:hover { border-color: var(--primary); }
147
+ .example-node video { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
148
+ .example-node span { display: block; padding: 0.4rem 0.6rem; font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
149
 
150
+ /* --- Preview Panel --- */
151
+ .preview {
152
+ grid-area: preview;
 
 
153
  background: #000;
154
+ display: flex;
 
 
 
155
  align-items: center;
156
  justify-content: center;
157
+ position: relative;
158
+ padding: 2rem;
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
 
161
+ .video-container {
162
+ width: 100%;
163
+ max-width: 1000px;
164
+ aspect-ratio: 16/9;
165
+ background: #050505;
166
+ box-shadow: 0 20px 50px rgba(0,0,0,0.5);
167
+ border-radius: 4px;
168
+ overflow: hidden;
169
+ position: relative;
170
  }
171
 
172
+ #main-video { width: 100%; height: 100%; object-fit: contain; }
 
 
 
173
 
174
+ .analyze-overlay {
175
+ position: absolute;
176
+ bottom: 2rem;
177
+ right: 2rem;
178
  }
179
 
180
+ .btn-analyze {
181
+ background: var(--primary);
182
+ color: white;
183
+ border: none;
184
+ padding: 0.6rem 1.25rem;
185
+ border-radius: 2rem;
186
+ font-weight: 600;
187
+ font-size: 0.85rem;
188
+ cursor: pointer;
189
+ box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
190
  display: flex;
191
  align-items: center;
192
  gap: 0.5rem;
193
+ transition: all 0.2s;
194
  }
195
 
196
+ .btn-analyze:hover:not(:disabled) { transform: scale(1.05); background: #7c3aed; }
197
+ .btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; }
 
 
 
 
198
 
199
+ /* --- Inspector Panel --- */
200
+ .inspector {
201
+ grid-area: inspector;
202
+ background: var(--bg-surface);
203
+ border-left: 1px solid var(--border);
204
+ display: flex;
205
+ flex-direction: column;
206
  overflow: hidden;
 
 
 
 
 
 
 
 
207
  }
208
 
209
+ .inspector-content {
210
+ flex: 1;
211
+ overflow-y: auto;
212
+ padding: 0;
213
  }
214
 
215
+ /* Result table override */
216
+ .result-table-wrap { width: 100%; }
217
+ .result-table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
218
+ .result-table th {
219
+ background: var(--bg-elevated);
220
+ padding: 0.5rem;
221
+ text-align: left;
222
+ color: var(--text-dim);
223
+ font-weight: 500;
224
+ border-bottom: 1px solid var(--border);
225
+ position: sticky; top: 0;
226
  }
227
+ .result-table td { padding: 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-main); }
228
+ .result-table tr:hover { background: rgba(255,255,255,0.03); }
229
 
230
+ /* --- Timeline Panel --- */
231
+ .timeline {
232
+ grid-area: timeline;
233
+ background: var(--bg-surface);
234
+ border-top: 1px solid var(--border);
235
+ display: flex;
236
+ flex-direction: column;
237
+ overflow: hidden;
238
  }
239
 
240
+ .timeline-track {
241
+ flex: 1;
242
+ overflow-x: auto;
243
+ overflow-y: hidden;
244
+ padding: 1rem;
245
+ display: flex;
246
+ gap: 4px;
247
+ align-items: center;
248
+ background: var(--bg-base);
249
  }
250
 
251
+ .timeline-item {
252
+ flex: 0 0 280px;
253
+ aspect-ratio: 16/9;
254
+ background: var(--bg-elevated);
255
+ border: 1px solid var(--border);
256
+ border-radius: 2px;
257
+ overflow: hidden;
258
+ position: relative;
259
+ cursor: pointer;
260
+ transition: transform 0.2s, border-color 0.2s;
261
  }
262
 
263
+ .timeline-item:hover {
264
+ border-color: var(--primary);
265
+ z-index: 10;
266
  }
267
 
268
+ .timeline-item img { width: 100%; height: 100%; object-fit: cover; }
269
+ .timeline-item .timestamp {
270
+ position: absolute;
271
+ bottom: 4px;
272
+ left: 4px;
273
+ background: rgba(0,0,0,0.7);
274
+ padding: 2px 4px;
275
+ font-size: 10px;
276
+ font-family: 'JetBrains Mono', monospace;
277
+ border-radius: 2px;
278
  }
279
 
280
+ /* --- Loader --- */
281
+ .loader-overlay {
282
  position: fixed;
283
+ inset: 0;
284
+ background: rgba(0,0,0,0.8);
285
+ backdrop-filter: blur(8px);
286
+ z-index: 1000;
 
287
  display: none;
288
  flex-direction: column;
289
  align-items: center;
290
  justify-content: center;
 
 
291
  }
292
 
293
  .spinner {
294
+ width: 48px;
295
+ height: 48px;
296
+ border: 3px solid var(--border);
297
+ border-top-color: var(--primary);
298
  border-radius: 50%;
299
  animation: spin 1s linear infinite;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
301
 
302
+ @keyframes spin { to { transform: rotate(360deg); } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
 
304
+ /* --- Modal --- */
305
  .modal {
 
306
  position: fixed;
307
+ inset: 0;
308
+ background: rgba(0,0,0,0.95);
 
 
 
309
  z-index: 2000;
310
+ display: none;
311
  align-items: center;
312
+ justify-content: center;
313
  padding: 2rem;
314
  }
315
 
316
+ .modal-content { max-width: 90%; max-height: 90%; object-fit: contain; }
317
+ .close-modal { position: absolute; top: 1rem; right: 1rem; cursor: pointer; color: var(--text-dim); }
 
 
 
318
 
319
+ .empty-state {
320
+ display: flex;
321
+ flex-direction: column;
322
+ align-items: center;
323
+ justify-content: center;
324
+ height: 100%;
325
+ color: var(--text-dim);
326
+ font-size: 0.8rem;
327
+ text-align: center;
328
+ padding: 2rem;
329
  }
330
  </style>
331
  </head>
332
  <body>
333
 
334
  <header>
335
+ <div class="brand">
336
+ <i data-lucide="video"></i>
337
+ <span>OMNISHOTCUT <span style="color: var(--primary)">PRO</span></span>
338
+ </div>
339
+ <div class="header-actions">
340
+ <span id="status-tag" style="font-size: 0.7rem; color: var(--accent-green); display: flex; align-items: center; gap: 0.4rem;">
341
+ <span style="width: 6px; height: 6px; background: var(--accent-green); border-radius: 50%;"></span>
342
+ Engine Ready
343
+ </span>
344
  </div>
345
  </header>
346
 
347
+ <aside class="sidebar">
348
+ <div class="panel-header">
349
+ <span>Media Library</span>
350
+ <i data-lucide="plus" size="14" style="cursor: pointer;"></i>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  </div>
352
+ <div class="media-content">
353
+ <div class="upload-card" id="drop-zone">
354
+ <i data-lucide="upload-cloud"></i>
355
+ <p>Import Media</p>
356
+ <input type="file" id="video-input" accept="video/*" style="display: none;">
357
  </div>
358
 
359
+ <div class="panel-header" style="border: none; padding-left: 0;">Examples</div>
360
+ <div class="examples-list" id="examples-grid">
361
+ <!-- Examples load here -->
362
  </div>
363
+ </div>
364
+ </aside>
365
+
366
+ <main class="preview">
367
+ <div class="video-container">
368
+ <video id="main-video" controls></video>
369
+ <div id="empty-preview" class="empty-state">
370
+ <i data-lucide="film" size="48" style="margin-bottom: 1rem; opacity: 0.2;"></i>
371
+ <p>No media loaded.<br>Import a file to begin analysis.</p>
372
  </div>
373
+ </div>
374
+
375
+ <div class="analyze-overlay">
376
+ <button id="run-btn" class="btn-analyze" disabled>
377
+ <i data-lucide="zap"></i>
378
+ Analyze Shots
379
+ </button>
380
+ </div>
381
+ </main>
382
 
383
+ <aside class="inspector">
384
+ <div class="panel-header">
385
+ <span>Shot Inspector</span>
386
+ <span id="shot-count" style="background: var(--primary-muted); padding: 1px 6px; border-radius: 4px; color: var(--primary); font-size: 10px;">0 SHOTS</span>
387
+ </div>
388
+ <div class="inspector-content" id="table-container">
389
+ <div class="empty-state">
390
+ <p>Results will appear here after analysis.</p>
391
  </div>
392
+ </div>
393
+ </aside>
394
 
395
+ <footer class="timeline">
396
+ <div class="panel-header">
397
+ <span>Relational Visualization Track</span>
398
+ <div style="display: flex; gap: 1rem;">
399
+ <span style="font-size: 10px; color: var(--text-dim);">Frames: <span id="frame-info">--</span></span>
400
+ </div>
401
+ </div>
402
+ <div class="timeline-track" id="gallery">
403
+ <!-- Timeline items load here -->
404
+ </div>
405
+ </footer>
406
 
407
+ <div class="loader-overlay" id="loader">
408
  <div class="spinner"></div>
409
+ <p style="margin-top: 1.5rem; font-weight: 500; letter-spacing: 0.05em; font-size: 0.9rem;">PROCESSING TEMPORAL RELATIONS...</p>
410
  </div>
411
 
412
  <div class="modal" id="modal">
413
+ <i data-lucide="x" class="close-modal"></i>
414
  <img class="modal-content" id="modal-img">
415
  </div>
416
 
417
  <script type="module">
418
  import { Client, handle_file } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
419
 
420
+ // Initialize Icons
421
+ lucide.createIcons();
422
+
423
  const dropZone = document.getElementById('drop-zone');
424
  const videoInput = document.getElementById('video-input');
425
+ const mainVideo = document.getElementById('main-video');
426
+ const emptyPreview = document.getElementById('empty-preview');
427
  const runBtn = document.getElementById('run-btn');
428
  const loader = document.getElementById('loader');
 
429
  const gallery = document.getElementById('gallery');
430
  const tableContainer = document.getElementById('table-container');
431
+ const shotCountBadge = document.getElementById('shot-count');
432
  const modal = document.getElementById('modal');
433
  const modalImg = document.getElementById('modal-img');
434
  const examplesGrid = document.getElementById('examples-grid');
435
+ const frameInfo = document.getElementById('frame-info');
436
 
437
  let selectedFile = null;
438
  let client = null;
439
 
 
440
  async function initClient() {
441
  client = await Client.connect(window.location.origin);
442
+ console.log("OmniShotCut Engine Online");
443
+ loadExamples();
444
  }
445
  initClient();
446
 
 
447
  dropZone.onclick = () => videoInput.click();
448
+ videoInput.onchange = (e) => handleFile(e.target.files[0]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
 
450
  function handleFile(file) {
451
+ if (!file) return;
452
  selectedFile = file;
453
+ mainVideo.src = URL.createObjectURL(file);
454
+ mainVideo.style.display = 'block';
455
+ emptyPreview.style.display = 'none';
 
456
  runBtn.disabled = false;
457
  }
458
 
 
459
  runBtn.onclick = async () => {
460
  if (!selectedFile || !client) return;
461
 
462
  loader.style.display = 'flex';
463
+
 
464
  try {
465
  const result = await client.predict("/run_inference", {
466
  video_file: handle_file(selectedFile)
467
  });
468
+ renderResults(result.data[0]);
469
+ } catch (err) {
470
+ console.error(err);
471
+ alert("Analysis engine error. Check console.");
 
 
472
  } finally {
473
  loader.style.display = 'none';
474
  }
475
  };
476
 
477
  function renderResults(data) {
478
+ if (data.error) {
479
+ alert(data.error);
480
+ return;
481
+ }
482
 
483
+ shotCountBadge.innerText = `${data.shot_count} SHOTS`;
484
+
485
+ // Timeline rendering
486
  gallery.innerHTML = '';
487
+ data.gallery.forEach((file, idx) => {
488
  const item = document.createElement('div');
489
+ item.className = 'timeline-item';
490
  const img = document.createElement('img');
491
  img.src = file.url;
492
+
493
+ const ts = document.createElement('div');
494
+ ts.className = 'timestamp';
495
+ ts.innerText = `SHOT_${idx.toString().padStart(2, '0')}`;
496
+
497
  item.appendChild(img);
498
+ item.appendChild(ts);
499
+
500
  item.onclick = () => {
501
  modalImg.src = file.url;
502
  modal.style.display = 'flex';
 
504
  gallery.appendChild(item);
505
  });
506
 
507
+ // Table rendering
508
  tableContainer.innerHTML = data.table;
509
+ frameInfo.innerText = data.shot_count > 0 ? "Analyzed" : "--";
 
 
510
  }
511
 
 
 
 
 
 
 
512
  async function loadExamples() {
513
  try {
 
514
  const result = await client.predict("/get_examples", {});
515
  const examples = result.data[0];
 
516
  examplesGrid.innerHTML = '';
517
+
518
  examples.forEach(ex => {
519
+ const node = document.createElement('div');
520
+ node.className = 'example-node';
521
 
522
  const video = document.createElement('video');
523
  video.src = ex.url;
 
525
  video.preload = "metadata";
526
  video.onloadedmetadata = () => video.currentTime = 0.1;
527
 
528
+ const label = document.createElement('span');
529
+ label.innerText = ex.orig_name || 'Clip';
530
 
531
+ node.appendChild(video);
532
+ node.appendChild(label);
 
533
 
534
+ node.onmouseenter = () => video.play();
535
+ node.onmouseleave = () => { video.pause(); video.currentTime = 0.1; };
536
 
537
+ node.onclick = async () => {
538
+ const response = await fetch(ex.url);
539
+ const blob = await response.blob();
540
+ handleFile(new File([blob], ex.orig_name || 'clip.mp4', { type: 'video/mp4' }));
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  };
542
 
543
+ examplesGrid.appendChild(node);
544
  });
545
+ } catch (e) { console.error("Examples load failed"); }
 
 
546
  }
547
+
548
+ document.querySelector('.close-modal').onclick = () => modal.style.display = 'none';
549
+ modal.onclick = (e) => { if (e.target === modal) modal.style.display = 'none'; };
550
 
551
  </script>
552
  </body>