dataquantals commited on
Commit
a871d6b
·
verified ·
1 Parent(s): cfcfaf1

undefined - Initial Deployment

Browse files
Files changed (1) hide show
  1. index.html +382 -306
index.html CHANGED
@@ -3,29 +3,20 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Interviews - Quantals Collect</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
- <!-- FullCalendar -->
10
- <link href='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.css' rel='stylesheet' />
11
- <script src='https://cdn.jsdelivr.net/npm/fullcalendar@5.11.3/main.min.js'></script>
12
- <!-- Wavesurfer.js -->
13
  <script src="https://unpkg.com/wavesurfer.js@6.6.3"></script>
14
- <!-- TensorFlow.js -->
15
- <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
 
 
 
16
  <style>
17
- /* Custom styles */
18
  .sidebar {
19
  transition: all 0.3s ease;
20
  }
21
- .recording-pulse {
22
- animation: pulse 2s infinite;
23
- }
24
- @keyframes pulse {
25
- 0% { opacity: 1; }
26
- 50% { opacity: 0.5; }
27
- 100% { opacity: 1; }
28
- }
29
  .waveform-container {
30
  background: linear-gradient(90deg, #03045e, #accd5a, #fb5607);
31
  background-size: 400% 400%;
@@ -36,29 +27,38 @@
36
  50% { background-position: 100% 50%; }
37
  100% { background-position: 0% 50%; }
38
  }
39
- .metadata-drawer {
40
- transition: transform 0.3s ease-in-out;
 
 
41
  }
42
- .metadata-drawer.open {
43
- transform: translateY(0);
 
44
  }
45
- .metadata-drawer.closed {
46
- transform: translateY(100%);
 
 
 
47
  }
48
- .timestamp-link {
49
- color: var(--quantals-purple);
50
- cursor: pointer;
51
  }
52
- .timestamp-link:hover {
53
- text-decoration: underline;
 
 
 
 
54
  }
55
- .conflict-highlight {
56
- background-color: rgba(239, 68, 68, 0.1);
57
- border: 1px solid #ef4444;
58
  }
59
  </style>
60
  </head>
61
- <body class="bg-gray-50 font-sans">
62
  <div class="flex h-screen overflow-hidden">
63
  <!-- Sidebar -->
64
  <div class="sidebar bg-indigo-800 text-white w-64 flex flex-col">
@@ -82,7 +82,7 @@
82
  <i class="fas fa-users"></i>
83
  <span>Participants</span>
84
  </a>
85
- <a href="interviews.html" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-700 text-white">
86
  <i class="fas fa-microphone"></i>
87
  <span>Interviews</span>
88
  </a>
@@ -98,7 +98,7 @@
98
  <i class="fas fa-robot"></i>
99
  <span>AI Assist</span>
100
  </a>
101
- <a href="transcriber.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
102
  <i class="fas fa-keyboard"></i>
103
  <span>Transcriber</span>
104
  </a>
@@ -114,345 +114,421 @@
114
 
115
  <!-- Main Content Area -->
116
  <div class="flex-1 flex flex-col overflow-hidden">
117
- <!-- Top Navigation -->
118
  <header class="bg-white shadow-sm p-4">
119
- <div class="flex justify-between items-center">
120
- <h2 class="text-xl font-semibold text-gray-800">Interviews</h2>
121
- <div class="flex items-center space-x-4">
122
- <button class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">
123
- <i class="fas fa-plus mr-2"></i>New Interview
124
- </button>
125
- <div class="relative">
126
- <input type="text" placeholder="Search interviews..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
127
- <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
128
- </div>
129
- </div>
130
  </div>
131
  </header>
132
 
133
  <!-- Main Content -->
134
- <div class="flex-1 flex overflow-hidden">
135
- <!-- Interview Scheduler (Left Panel) -->
136
- <div class="w-80 border-r border-gray-200 bg-white overflow-y-auto">
137
- <div class="p-4">
138
- <h3 class="text-lg font-semibold text-gray-800 mb-4">Schedule</h3>
139
- <div id="calendar"></div>
 
 
 
 
 
 
140
  </div>
141
  </div>
142
 
143
- <!-- Recording Workspace (Center Panel) -->
144
- <div class="flex-1 flex flex-col overflow-hidden">
145
- <div class="flex-1 p-6 overflow-y-auto">
146
- <div class="max-w-4xl mx-auto">
147
- <!-- Recording Controls -->
148
- <div class="bg-white rounded-xl shadow-sm p-6 mb-6">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  <div class="flex justify-between items-center mb-4">
150
- <h3 class="text-lg font-semibold text-gray-800">Recording Session</h3>
151
- <div class="flex items-center space-x-4">
152
- <select id="audioDeviceSelect" class="px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
153
- <option value="">Select Microphone</option>
 
 
 
 
 
154
  </select>
155
- <span class="text-sm text-gray-500">00:32:45</span>
156
- <button class="p-2 rounded-full bg-gray-500 text-white">
157
- <i class="fas fa-microphone"></i>
158
- </button>
159
  </div>
160
  </div>
161
 
162
- <div class="waveform-container h-32 rounded-lg mb-4" id="waveform"></div>
163
 
164
  <div class="flex justify-center space-x-4">
165
- <button class="p-3 bg-gray-100 rounded-full hover:bg-gray-200">
166
  <i class="fas fa-step-backward text-gray-600"></i>
167
  </button>
168
- <button class="p-3 bg-gray-100 rounded-full hover:bg-gray-200">
169
- <i class="fas fa-pause text-gray-600"></i>
170
  </button>
171
- <button class="p-3 bg-gray-100 rounded-full hover:bg-gray-200">
172
  <i class="fas fa-step-forward text-gray-600"></i>
173
  </button>
174
  </div>
175
 
176
- <!-- Recording Status -->
177
- <div class="mt-4 p-4 bg-gray-50 rounded-lg">
 
 
 
 
 
 
 
 
178
  <div class="flex items-center space-x-2">
179
- <div class="w-2 h-2 rounded-full bg-gray-400"></div>
180
- <span class="text-sm text-gray-600">Ready to record</span>
 
 
 
 
 
 
 
181
  </div>
182
- <div class="mt-2 text-sm text-gray-500">
183
- <p>Selected device: <span id="selectedDeviceName">Default Microphone</span></p>
184
- <p>Recording format: WAV (44.1kHz, 16-bit)</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  </div>
186
  </div>
 
 
 
 
 
 
 
 
 
187
  </div>
188
 
189
- <!-- Live Transcription -->
190
- <div class="bg-white rounded-xl shadow-sm p-6">
191
- <h3 class="text-lg font-semibold text-gray-800 mb-4">Live Transcription</h3>
192
- <div class="h-64 overflow-y-auto p-4 bg-gray-50 rounded-lg">
193
- <p class="text-gray-600">[10:23] Interviewer: Welcome to our session today...</p>
194
- <p class="text-gray-600">[10:24] Participant: Thank you for having me...</p>
 
 
 
 
 
 
 
 
 
 
195
  </div>
196
  </div>
197
- </div>
198
- </div>
199
- </div>
200
 
201
- <!-- Live Notes Panel (Right Panel) -->
202
- <div class="w-80 border-l border-gray-200 bg-white overflow-y-auto">
203
- <div class="p-4">
204
- <h3 class="text-lg font-semibold text-gray-800 mb-4">Live Notes</h3>
205
- <div class="space-y-4">
206
- <div class="p-4 bg-gray-50 rounded-lg">
207
- <p class="text-sm text-gray-600">[10:25] Key point about park safety</p>
208
- <div class="mt-2 flex items-center space-x-2">
209
- <span class="px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full">#safety</span>
210
- <span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">#parks</span>
 
 
211
  </div>
 
212
  </div>
213
  </div>
214
  </div>
215
  </div>
216
  </div>
217
-
218
- <!-- Metadata Editor (Bottom Drawer) -->
219
- <div class="metadata-drawer bg-white border-t border-gray-200 p-4">
220
- <div class="flex justify-between items-center mb-4">
221
- <h3 class="text-lg font-semibold text-gray-800">Session Metadata</h3>
222
- <button class="p-2 hover:bg-gray-100 rounded-lg">
223
- <i class="fas fa-chevron-down text-gray-600"></i>
224
- </button>
225
- </div>
226
- <div class="grid grid-cols-3 gap-4">
227
- <div>
228
- <label class="block text-sm font-medium text-gray-700 mb-1">Session Type</label>
229
- <select class="w-full border border-gray-300 rounded-lg px-3 py-2">
230
- <option>In-person</option>
231
- <option>Remote</option>
232
- </select>
233
- </div>
234
- <div>
235
- <label class="block text-sm font-medium text-gray-700 mb-1">Equipment</label>
236
- <input type="text" class="w-full border border-gray-300 rounded-lg px-3 py-2" placeholder="Enter equipment used">
237
- </div>
238
- <div>
239
- <label class="block text-sm font-medium text-gray-700 mb-1">Classification</label>
240
- <select class="w-full border border-gray-300 rounded-lg px-3 py-2">
241
- <option>Public</option>
242
- <option>Confidential</option>
243
- <option>Restricted</option>
244
- </select>
245
- </div>
246
- </div>
247
- </div>
248
  </div>
249
  </div>
250
 
 
251
  <script>
252
- // Initialize FullCalendar with enhanced configuration
253
- document.addEventListener('DOMContentLoaded', function() {
254
- const calendarEl = document.getElementById('calendar');
255
- const calendar = new FullCalendar.Calendar(calendarEl, {
256
- initialView: 'timeGridWeek',
257
- headerToolbar: {
258
- left: 'prev,next today',
259
- center: 'title',
260
- right: 'timeGridWeek,timeGridDay'
261
- },
262
- slotMinTime: '08:00:00',
263
- slotMaxTime: '20:00:00',
264
- allDaySlot: false,
265
- slotDuration: '00:30:00',
266
- snapDuration: '00:15:00',
267
- eventOverlap: false,
268
- eventConstraint: {
269
- startTime: '08:00',
270
- endTime: '20:00',
271
- dows: [1, 2, 3, 4, 5] // Monday to Friday
272
- },
273
- eventDidMount: function(info) {
274
- // Check for conflicts
275
- const events = calendar.getEvents();
276
- const hasConflict = events.some(event => {
277
- if (event.id === info.event.id) return false;
278
- return (
279
- (info.event.start < event.end && info.event.end > event.start)
280
- );
281
- });
282
- if (hasConflict) {
283
- info.el.classList.add('conflict-highlight');
284
- }
285
- },
286
- editable: true,
287
- droppable: true,
288
- events: [
289
- {
290
- title: 'Interview with Maria',
291
- start: '2024-03-20T10:00:00',
292
- end: '2024-03-20T11:00:00',
293
- backgroundColor: '#4f46e5',
294
- extendedProps: {
295
- participant: 'Maria Gonzalez',
296
- project: 'Urban Sustainability Study',
297
- teamMembers: ['John Doe', 'Jane Smith']
298
- }
299
- }
300
- ]
301
- });
302
- calendar.render();
303
  });
304
 
305
- // Device Recording Resource Handling
306
- class RecordingManager {
307
- constructor() {
308
- this.mediaRecorder = null;
309
- this.audioChunks = [];
310
- this.isRecording = false;
311
- this.stream = null;
312
- this.availableDevices = {
313
- audioInputs: [],
314
- videoInputs: []
315
- };
316
- }
317
 
318
- async initialize() {
319
- try {
320
- // Get available devices
321
- const devices = await navigator.mediaDevices.enumerateDevices();
322
- this.availableDevices.audioInputs = devices.filter(device => device.kind === 'audioinput');
323
- this.availableDevices.videoInputs = devices.filter(device => device.kind === 'videoinput');
324
-
325
- // Update device selectors
326
- this.updateDeviceSelectors();
327
-
328
- // Initialize default audio stream
329
- await this.setupAudioStream(this.availableDevices.audioInputs[0]?.deviceId);
330
- } catch (error) {
331
- console.error('Error initializing recording:', error);
332
- this.showError('Failed to initialize recording devices');
333
- }
334
- }
335
 
336
- updateDeviceSelectors() {
337
- const audioSelect = document.getElementById('audioDeviceSelect');
338
- if (audioSelect) {
339
- audioSelect.innerHTML = this.availableDevices.audioInputs
340
- .map(device => `<option value="${device.deviceId}">${device.label || `Microphone ${device.deviceId}`}</option>`)
341
- .join('');
342
- }
343
- }
344
 
345
- async setupAudioStream(deviceId) {
346
- try {
347
- const constraints = {
348
- audio: deviceId ? { deviceId: { exact: deviceId } } : true,
349
- video: false
350
- };
351
-
352
- this.stream = await navigator.mediaDevices.getUserMedia(constraints);
353
-
354
- // Initialize WaveSurfer with the audio stream
355
- wavesurfer.microphone.start({
356
- stream: this.stream,
357
- bufferSize: 4096
358
- });
359
-
360
- // Initialize MediaRecorder
361
- this.mediaRecorder = new MediaRecorder(this.stream);
362
- this.setupMediaRecorderEvents();
363
- } catch (error) {
364
- console.error('Error setting up audio stream:', error);
365
- this.showError('Failed to access microphone');
366
- }
367
- }
368
 
369
- setupMediaRecorderEvents() {
370
- this.mediaRecorder.ondataavailable = (event) => {
371
- if (event.data.size > 0) {
372
- this.audioChunks.push(event.data);
373
- }
374
- };
375
-
376
- this.mediaRecorder.onstop = () => {
377
- const audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' });
378
- const audioUrl = URL.createObjectURL(audioBlob);
379
- wavesurfer.load(audioUrl);
380
- this.audioChunks = [];
381
- };
382
- }
383
 
384
- async startRecording() {
385
- if (!this.mediaRecorder) {
386
- await this.initialize();
387
- }
 
 
388
 
389
- try {
390
- this.audioChunks = [];
391
- this.mediaRecorder.start();
392
- this.isRecording = true;
393
- this.updateRecordingUI(true);
394
- } catch (error) {
395
- console.error('Error starting recording:', error);
396
- this.showError('Failed to start recording');
397
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  }
 
 
 
 
 
399
 
400
- stopRecording() {
401
- if (this.mediaRecorder && this.isRecording) {
402
- this.mediaRecorder.stop();
403
- this.isRecording = false;
404
- this.updateRecordingUI(false);
405
- }
 
406
  }
 
 
407
 
408
- updateRecordingUI(isRecording) {
409
- const recordButton = document.querySelector('.recording-pulse');
410
- if (recordButton) {
411
- recordButton.classList.toggle('bg-red-500', isRecording);
412
- recordButton.classList.toggle('bg-gray-500', !isRecording);
413
- recordButton.classList.toggle('recording-pulse', isRecording);
414
- }
415
  }
 
416
 
417
- showError(message) {
418
- // Implement error notification UI
419
- console.error(message);
 
420
  }
 
 
 
 
 
 
421
 
422
- async switchDevice(deviceId) {
423
- if (this.stream) {
424
- this.stream.getTracks().forEach(track => track.stop());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  }
426
- await this.setupAudioStream(deviceId);
 
 
 
 
 
 
 
 
 
 
427
  }
428
  }
429
 
430
- // Initialize recording manager
431
- const recordingManager = new RecordingManager();
432
- recordingManager.initialize();
433
-
434
- // Update recording controls
435
- const recordButton = document.querySelector('.recording-pulse');
436
- recordButton.addEventListener('click', async () => {
437
- if (recordingManager.isRecording) {
438
- recordingManager.stopRecording();
439
- } else {
440
- await recordingManager.startRecording();
441
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  });
443
 
444
- // Handle device selection
445
- document.getElementById('audioDeviceSelect')?.addEventListener('change', (e) => {
446
- recordingManager.switchDevice(e.target.value);
447
  });
448
 
449
- // Handle metadata drawer
450
- const metadataDrawer = document.querySelector('.metadata-drawer');
451
- const toggleDrawer = document.querySelector('.metadata-drawer button');
452
- toggleDrawer.addEventListener('click', () => {
453
- metadataDrawer.classList.toggle('open');
454
- metadataDrawer.classList.toggle('closed');
 
 
455
  });
 
 
 
456
  </script>
457
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://deepsite.hf.co/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=dataquantals/quantals-collect" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
458
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Transcriber - Quantals Collect</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <!-- Wavesurfer.js for audio visualization -->
 
 
 
10
  <script src="https://unpkg.com/wavesurfer.js@6.6.3"></script>
11
+ <!-- CodeMirror for rich text editing -->
12
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css" rel="stylesheet">
13
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/theme/monokai.min.css" rel="stylesheet">
14
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/markdown/markdown.min.js"></script>
16
  <style>
 
17
  .sidebar {
18
  transition: all 0.3s ease;
19
  }
 
 
 
 
 
 
 
 
20
  .waveform-container {
21
  background: linear-gradient(90deg, #03045e, #accd5a, #fb5607);
22
  background-size: 400% 400%;
 
27
  50% { background-position: 100% 50%; }
28
  100% { background-position: 0% 50%; }
29
  }
30
+ .CodeMirror {
31
+ height: calc(100vh - 400px);
32
+ border: 1px solid #e5e7eb;
33
+ border-radius: 0.5rem;
34
  }
35
+ .loading-dots::after {
36
+ content: '...';
37
+ animation: dots 1.5s steps(5, end) infinite;
38
  }
39
+ @keyframes dots {
40
+ 0%, 20% { content: '.'; }
41
+ 40% { content: '..'; }
42
+ 60% { content: '...'; }
43
+ 80%, 100% { content: ''; }
44
  }
45
+ .fade-in {
46
+ animation: fadeIn 0.3s ease-in;
 
47
  }
48
+ @keyframes fadeIn {
49
+ from { opacity: 0; }
50
+ to { opacity: 1; }
51
+ }
52
+ .transcription-mode {
53
+ transition: all 0.3s ease;
54
  }
55
+ .transcription-mode.active {
56
+ background-color: #4f46e5;
57
+ color: white;
58
  }
59
  </style>
60
  </head>
61
+ <body class="bg-gray-50">
62
  <div class="flex h-screen overflow-hidden">
63
  <!-- Sidebar -->
64
  <div class="sidebar bg-indigo-800 text-white w-64 flex flex-col">
 
82
  <i class="fas fa-users"></i>
83
  <span>Participants</span>
84
  </a>
85
+ <a href="interviews.html" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
86
  <i class="fas fa-microphone"></i>
87
  <span>Interviews</span>
88
  </a>
 
98
  <i class="fas fa-robot"></i>
99
  <span>AI Assist</span>
100
  </a>
101
+ <a href="transcriber.html" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-700 text-white">
102
  <i class="fas fa-keyboard"></i>
103
  <span>Transcriber</span>
104
  </a>
 
114
 
115
  <!-- Main Content Area -->
116
  <div class="flex-1 flex flex-col overflow-hidden">
117
+ <!-- Header -->
118
  <header class="bg-white shadow-sm p-4">
119
+ <div class="max-w-7xl mx-auto">
120
+ <h1 class="text-2xl font-bold text-gray-900">Transcriber</h1>
121
+ <p class="mt-1 text-sm text-gray-600">
122
+ Transcribe interviews, field recordings, or videos manually or with AI.
123
+ </p>
 
 
 
 
 
 
124
  </div>
125
  </header>
126
 
127
  <!-- Main Content -->
128
+ <div class="flex-1 flex flex-col overflow-hidden">
129
+ <!-- Mode Toggle -->
130
+ <div class="bg-white border-b border-gray-200">
131
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
132
+ <div class="flex space-x-4">
133
+ <button id="manual-mode" class="transcription-mode px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100 active">
134
+ <i class="fas fa-keyboard mr-2"></i>Manual Transcription
135
+ </button>
136
+ <button id="ai-mode" class="transcription-mode px-4 py-2 rounded-lg text-gray-600 hover:bg-gray-100">
137
+ <i class="fas fa-robot mr-2"></i>AI Transcription
138
+ </button>
139
+ </div>
140
  </div>
141
  </div>
142
 
143
+ <!-- Workspace -->
144
+ <div class="flex-1 p-4 overflow-y-auto">
145
+ <div class="max-w-7xl mx-auto">
146
+ <!-- Manual Transcription Workspace -->
147
+ <div id="manual-workspace" class="space-y-4">
148
+ <!-- Upload Media -->
149
+ <div class="bg-white rounded-lg shadow-sm p-4">
150
+ <div class="flex justify-between items-center mb-4">
151
+ <h3 class="text-lg font-semibold text-gray-800">Upload Media</h3>
152
+ </div>
153
+
154
+ <div class="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center">
155
+ <input type="file" id="manual-media-upload" class="hidden" accept=".mp3,.wav,.mp4">
156
+ <label for="manual-media-upload" class="cursor-pointer">
157
+ <i class="fas fa-cloud-upload-alt text-4xl text-gray-400 mb-2"></i>
158
+ <p class="text-gray-600">Drag and drop your audio/video file here or click to browse</p>
159
+ <p class="text-sm text-gray-500 mt-1">Max file size: 100MB</p>
160
+ </label>
161
+ </div>
162
+ </div>
163
+
164
+ <!-- Audio Player -->
165
+ <div class="bg-white rounded-lg shadow-sm p-4">
166
  <div class="flex justify-between items-center mb-4">
167
+ <h3 class="text-lg font-semibold text-gray-800">Audio Player</h3>
168
+ <div class="flex items-center space-x-2">
169
+ <select id="playback-speed" class="px-2 py-1 text-sm border border-gray-300 rounded-lg">
170
+ <option value="0.5">0.5x</option>
171
+ <option value="0.75">0.75x</option>
172
+ <option value="1" selected>1x</option>
173
+ <option value="1.25">1.25x</option>
174
+ <option value="1.5">1.5x</option>
175
+ <option value="2">2x</option>
176
  </select>
 
 
 
 
177
  </div>
178
  </div>
179
 
180
+ <div class="waveform-container h-24 rounded-lg mb-4" id="waveform"></div>
181
 
182
  <div class="flex justify-center space-x-4">
183
+ <button class="p-2 bg-gray-100 rounded-full hover:bg-gray-200" id="skip-backward">
184
  <i class="fas fa-step-backward text-gray-600"></i>
185
  </button>
186
+ <button class="p-2 bg-gray-100 rounded-full hover:bg-gray-200" id="play-pause">
187
+ <i class="fas fa-play text-gray-600"></i>
188
  </button>
189
+ <button class="p-2 bg-gray-100 rounded-full hover:bg-gray-200" id="skip-forward">
190
  <i class="fas fa-step-forward text-gray-600"></i>
191
  </button>
192
  </div>
193
 
194
+ <div class="mt-4 flex justify-between items-center text-sm text-gray-500">
195
+ <span id="current-time">00:00</span>
196
+ <span id="duration">00:00</span>
197
+ </div>
198
+ </div>
199
+
200
+ <!-- Transcription Editor -->
201
+ <div class="bg-white rounded-lg shadow-sm p-4">
202
+ <div class="flex justify-between items-center mb-4">
203
+ <h3 class="text-lg font-semibold text-gray-800">Transcription</h3>
204
  <div class="flex items-center space-x-2">
205
+ <button id="insert-timestamp" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
206
+ <i class="fas fa-clock mr-1"></i>Insert Timestamp
207
+ </button>
208
+ <button id="save-draft" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
209
+ <i class="fas fa-save mr-1"></i>Save Draft
210
+ </button>
211
+ <button id="export-transcript" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
212
+ <i class="fas fa-download mr-1"></i>Export
213
+ </button>
214
  </div>
215
+ </div>
216
+ <textarea id="transcription-editor" class="w-full h-64 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea>
217
+ </div>
218
+ </div>
219
+
220
+ <!-- AI Transcription Workspace -->
221
+ <div id="ai-workspace" class="hidden space-y-4">
222
+ <!-- File Upload -->
223
+ <div class="bg-white rounded-lg shadow-sm p-4">
224
+ <div class="flex justify-between items-center mb-4">
225
+ <h3 class="text-lg font-semibold text-gray-800">Upload Media</h3>
226
+ <div class="flex items-center space-x-2">
227
+ <select id="language-select" class="px-3 py-1 text-sm border border-gray-300 rounded-lg">
228
+ <option value="en">English</option>
229
+ <option value="es">Spanish</option>
230
+ <option value="fr">French</option>
231
+ <option value="de">German</option>
232
+ <option value="zh">Chinese</option>
233
+ </select>
234
  </div>
235
  </div>
236
+
237
+ <div class="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center">
238
+ <input type="file" id="media-upload" class="hidden" accept=".mp3,.wav,.mp4">
239
+ <label for="media-upload" class="cursor-pointer">
240
+ <i class="fas fa-cloud-upload-alt text-4xl text-gray-400 mb-2"></i>
241
+ <p class="text-gray-600">Drag and drop your audio/video file here or click to browse</p>
242
+ <p class="text-sm text-gray-500 mt-1">Max file size: 100MB</p>
243
+ </label>
244
+ </div>
245
  </div>
246
 
247
+ <!-- AI Options -->
248
+ <div class="bg-white rounded-lg shadow-sm p-4">
249
+ <h3 class="text-lg font-semibold text-gray-800 mb-4">AI Enhancement Options</h3>
250
+ <div class="grid grid-cols-2 gap-4">
251
+ <button class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50">
252
+ <i class="fas fa-brain text-indigo-600 mr-2"></i>Summarize Transcript
253
+ </button>
254
+ <button class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50">
255
+ <i class="fas fa-tags text-indigo-600 mr-2"></i>Generate Speaker Labels
256
+ </button>
257
+ <button class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50">
258
+ <i class="fas fa-language text-indigo-600 mr-2"></i>Translate to English
259
+ </button>
260
+ <button class="p-3 border border-gray-200 rounded-lg hover:bg-gray-50">
261
+ <i class="fas fa-search text-indigo-600 mr-2"></i>Highlight Keywords
262
+ </button>
263
  </div>
264
  </div>
 
 
 
265
 
266
+ <!-- Output Panel -->
267
+ <div class="bg-white rounded-lg shadow-sm p-4">
268
+ <div class="flex justify-between items-center mb-4">
269
+ <h3 class="text-lg font-semibold text-gray-800">Transcription Output</h3>
270
+ <div class="flex items-center space-x-2">
271
+ <button id="copy-output" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
272
+ <i class="fas fa-copy mr-1"></i>Copy
273
+ </button>
274
+ <button id="download-output" class="px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded-lg">
275
+ <i class="fas fa-download mr-1"></i>Download
276
+ </button>
277
+ </div>
278
  </div>
279
+ <div id="ai-output" class="w-full min-h-64 p-3 border border-gray-300 rounded-lg bg-gray-50"></div>
280
  </div>
281
  </div>
282
  </div>
283
  </div>
284
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  </div>
286
  </div>
287
 
288
+ <!-- Scripts -->
289
  <script>
290
+ // Initialize WaveSurfer
291
+ const wavesurfer = WaveSurfer.create({
292
+ container: '#waveform',
293
+ waveColor: '#4f46e5',
294
+ progressColor: '#818cf8',
295
+ cursorColor: '#1e40af',
296
+ barWidth: 2,
297
+ barRadius: 3,
298
+ responsive: true,
299
+ height: 80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  });
301
 
302
+ // Get editor element
303
+ const editor = document.getElementById('transcription-editor');
 
 
 
 
 
 
 
 
 
 
304
 
305
+ // Mode Toggle
306
+ const manualMode = document.getElementById('manual-mode');
307
+ const aiMode = document.getElementById('ai-mode');
308
+ const manualWorkspace = document.getElementById('manual-workspace');
309
+ const aiWorkspace = document.getElementById('ai-workspace');
 
 
 
 
 
 
 
 
 
 
 
 
310
 
311
+ manualMode.addEventListener('click', () => {
312
+ manualMode.classList.add('active');
313
+ aiMode.classList.remove('active');
314
+ manualWorkspace.classList.remove('hidden');
315
+ aiWorkspace.classList.add('hidden');
316
+ });
 
 
317
 
318
+ aiMode.addEventListener('click', () => {
319
+ aiMode.classList.add('active');
320
+ manualMode.classList.remove('active');
321
+ aiWorkspace.classList.remove('hidden');
322
+ manualWorkspace.classList.add('hidden');
323
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
+ // Audio Controls
326
+ const playPauseBtn = document.getElementById('play-pause');
327
+ const skipForwardBtn = document.getElementById('skip-forward');
328
+ const skipBackwardBtn = document.getElementById('skip-backward');
329
+ const playbackSpeed = document.getElementById('playback-speed');
330
+ const currentTime = document.getElementById('current-time');
331
+ const duration = document.getElementById('duration');
 
 
 
 
 
 
 
332
 
333
+ playPauseBtn.addEventListener('click', () => {
334
+ wavesurfer.playPause();
335
+ const icon = playPauseBtn.querySelector('i');
336
+ icon.classList.toggle('fa-play');
337
+ icon.classList.toggle('fa-pause');
338
+ });
339
 
340
+ skipForwardBtn.addEventListener('click', () => {
341
+ wavesurfer.skip(10);
342
+ });
343
+
344
+ skipBackwardBtn.addEventListener('click', () => {
345
+ wavesurfer.skip(-10);
346
+ });
347
+
348
+ playbackSpeed.addEventListener('change', (e) => {
349
+ wavesurfer.setPlaybackRate(parseFloat(e.target.value));
350
+ });
351
+
352
+ wavesurfer.on('ready', () => {
353
+ duration.textContent = formatTime(wavesurfer.getDuration());
354
+ });
355
+
356
+ wavesurfer.on('audioprocess', () => {
357
+ currentTime.textContent = formatTime(wavesurfer.getCurrentTime());
358
+ });
359
+
360
+ // Format time
361
+ function formatTime(time) {
362
+ const minutes = Math.floor(time / 60);
363
+ const seconds = Math.floor(time % 60);
364
+ return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
365
+ }
366
+
367
+ // Insert timestamp
368
+ document.getElementById('insert-timestamp').addEventListener('click', () => {
369
+ const time = formatTime(wavesurfer.getCurrentTime());
370
+ const start = editor.selectionStart;
371
+ const end = editor.selectionEnd;
372
+ const text = editor.value;
373
+ editor.value = text.substring(0, start) + `[${time}] ` + text.substring(end);
374
+ editor.focus();
375
+ editor.setSelectionRange(start + `[${time}] `.length, start + `[${time}] `.length);
376
+ });
377
+
378
+ // Keyboard shortcuts
379
+ document.addEventListener('keydown', (e) => {
380
+ if (e.code === 'Space' && !e.target.matches('textarea, input')) {
381
+ e.preventDefault();
382
+ playPauseBtn.click();
383
  }
384
+ if (e.ctrlKey && e.code === 'KeyB') {
385
+ e.preventDefault();
386
+ document.getElementById('insert-timestamp').click();
387
+ }
388
+ });
389
 
390
+ // File upload handling
391
+ const mediaUpload = document.getElementById('media-upload');
392
+ const manualMediaUpload = document.getElementById('manual-media-upload');
393
+
394
+ function handleMediaUpload(file) {
395
+ if (file.type.startsWith('audio/')) {
396
+ wavesurfer.loadBlob(file);
397
  }
398
+ handleFileUpload(file);
399
+ }
400
 
401
+ mediaUpload.addEventListener('change', (e) => {
402
+ const file = e.target.files[0];
403
+ if (file) {
404
+ handleMediaUpload(file);
 
 
 
405
  }
406
+ });
407
 
408
+ manualMediaUpload.addEventListener('change', (e) => {
409
+ const file = e.target.files[0];
410
+ if (file) {
411
+ handleMediaUpload(file);
412
  }
413
+ });
414
+
415
+ // Handle file upload for AI transcription
416
+ async function handleFileUpload(file) {
417
+ const formData = new FormData();
418
+ formData.append('file', file);
419
 
420
+ try {
421
+ const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
422
+ method: 'POST',
423
+ headers: {
424
+ 'Authorization': 'Bearer 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',
425
+ 'Content-Type': 'application/json'
426
+ },
427
+ body: JSON.stringify({
428
+ model: "deepseek-coder:52-r1",
429
+ messages: [
430
+ {
431
+ role: "system",
432
+ content: "You are a transcription assistant. Your task is to accurately transcribe audio into clean, readable text, removing filler words, stutters, and repetition unless contextually relevant."
433
+ },
434
+ {
435
+ role: "user",
436
+ content: "Transcribe the following audio file: " + file.name
437
+ }
438
+ ]
439
+ })
440
+ });
441
+
442
+ if (!response.ok) {
443
+ throw new Error('Transcription failed');
444
  }
445
+
446
+ const data = await response.json();
447
+ document.getElementById('ai-output').innerHTML = data.choices[0].message.content;
448
+ } catch (error) {
449
+ console.error('Error:', error);
450
+ document.getElementById('ai-output').innerHTML = `
451
+ <div class="text-red-600">
452
+ <i class="fas fa-exclamation-circle mr-2"></i>
453
+ Error: ${error.message}
454
+ </div>
455
+ `;
456
  }
457
  }
458
 
459
+ // Auto-save functionality
460
+ let autoSaveTimeout;
461
+ editor.addEventListener('input', () => {
462
+ clearTimeout(autoSaveTimeout);
463
+ autoSaveTimeout = setTimeout(() => {
464
+ localStorage.setItem('transcription_draft', editor.value);
465
+ }, 30000);
466
+ });
467
+
468
+ // Load draft on page load
469
+ const savedDraft = localStorage.getItem('transcription_draft');
470
+ if (savedDraft) {
471
+ editor.value = savedDraft;
472
+ }
473
+
474
+ // Export functionality
475
+ document.getElementById('export-transcript').addEventListener('click', () => {
476
+ const content = editor.value;
477
+ const blob = new Blob([content], { type: 'text/plain' });
478
+ const url = window.URL.createObjectURL(blob);
479
+ const a = document.createElement('a');
480
+ a.href = url;
481
+ a.download = `transcript-${new Date().toISOString()}.txt`;
482
+ document.body.appendChild(a);
483
+ a.click();
484
+ window.URL.revokeObjectURL(url);
485
+ document.body.removeChild(a);
486
+ });
487
+
488
+ // Copy output
489
+ document.getElementById('copy-output').addEventListener('click', () => {
490
+ const output = document.getElementById('ai-output').innerText;
491
+ navigator.clipboard.writeText(output).then(() => {
492
+ const button = document.getElementById('copy-output');
493
+ const originalText = button.innerHTML;
494
+ button.innerHTML = '<i class="fas fa-check mr-1"></i>Copied!';
495
+ setTimeout(() => {
496
+ button.innerHTML = originalText;
497
+ }, 2000);
498
+ });
499
+ });
500
+
501
+ // Download output
502
+ document.getElementById('download-output').addEventListener('click', () => {
503
+ const output = document.getElementById('ai-output').innerText;
504
+ const blob = new Blob([output], { type: 'text/plain' });
505
+ const url = window.URL.createObjectURL(blob);
506
+ const a = document.createElement('a');
507
+ a.href = url;
508
+ a.download = `ai-transcript-${new Date().toISOString()}.txt`;
509
+ document.body.appendChild(a);
510
+ a.click();
511
+ window.URL.revokeObjectURL(url);
512
+ document.body.removeChild(a);
513
  });
514
 
515
+ // Check online status
516
+ window.addEventListener('online', () => {
517
+ document.getElementById('ai-mode').disabled = false;
518
  });
519
 
520
+ window.addEventListener('offline', () => {
521
+ document.getElementById('ai-mode').disabled = true;
522
+ document.getElementById('ai-output').innerHTML = `
523
+ <div class="text-red-600">
524
+ <i class="fas fa-wifi-slash mr-2"></i>
525
+ No internet connection. Please check your network.
526
+ </div>
527
+ `;
528
  });
529
+
530
+ // Initialize
531
+ manualMode.click();
532
  </script>
533
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://deepsite.hf.co/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=dataquantals/quantals-collect" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
534
  </html>