datasciencesage commited on
Commit
396661b
Β·
1 Parent(s): 2d87a2f

Added the Html file

Browse files
Files changed (1) hide show
  1. templates/terminal.html +392 -0
templates/terminal.html ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Audio Processing Terminal</title>
5
+ <style>
6
+
7
+
8
+ body {
9
+ background-color: black;
10
+ color: #00ff00;
11
+ font-family: 'Courier New', monospace;
12
+ margin: 0;
13
+ padding: 0;
14
+ height: 100vh;
15
+ overflow: hidden;
16
+ font-size: 16px;
17
+ line-height: 1;
18
+ display: flex;
19
+ flex-direction: column;
20
+ }
21
+ .border-line {
22
+ color: #00ff00;
23
+ width: 100%;
24
+ text-align: center;
25
+ margin: 0 0;
26
+ font-size: 24px;
27
+ animation: textFlicker 0.05s infinite;
28
+ background-color: rgb(255, 0, 217);
29
+ }
30
+
31
+ .ascii-title {
32
+ text-align: center;
33
+ color: #00ff00;
34
+ white-space: pre;
35
+ line-height: 1.2;
36
+ font-family: 'Courier New', monospace;
37
+ font-size: 25px;
38
+ text-shadow: 0 0 5px #00ff00;
39
+ animation: textFlicker 0.05s infinite;
40
+
41
+
42
+ }
43
+ .header-text {
44
+ text-align: center;
45
+ justify-content: center;
46
+ align-items: center;
47
+ color: #00ff00;
48
+ white-space: pre;
49
+ line-height: 1.2;
50
+ font-family: 'Courier New', monospace;
51
+ font-size: 14px;
52
+ text-shadow: 0 0 5px #00ff00;
53
+ /* animation: textFlicker 0.05s infinite; */
54
+
55
+
56
+ }
57
+
58
+
59
+
60
+
61
+ .system-messages {
62
+ color: #00ff00;
63
+ font-size: 20px;
64
+ text-align: center;
65
+ margin-top: 10px;
66
+ animation: textFlicker 0.05s infinite;
67
+ /* animation: fadeIn 2s ease-in; */
68
+ }
69
+
70
+ @keyframes fadeIn {
71
+ from { opacity: 0; }
72
+ to { opacity: 1; }
73
+ }
74
+
75
+ /* Header Section (1/3) */
76
+ .header {
77
+ height: 40.0vh;
78
+ display: flex;
79
+ justify-content: center;
80
+ align-items: center;
81
+ /* border-bottom: 2px solid #00ff00; */
82
+ /* padding: 20px; */
83
+ flex-direction: column;
84
+ /* font-size: 25px; */
85
+ background-color: black;
86
+ overflow: hidden; /* Ensures no scrollbars for the header */
87
+ pointer-events: none;
88
+
89
+
90
+ }
91
+ .header h1 {
92
+ margin: 10px 0; /* Equal margins for top and bottom */
93
+ font-size: 3rem; /* Adjust this for title size */
94
+ text-align: center;
95
+ color: #333; /* Adjust color as needed */
96
+ }
97
+
98
+
99
+ .header pre {
100
+
101
+ font-family: 'Courier New', Courier, monospace; /* Use a monospaced font for ASCII art */
102
+ font-size: 1.2rem; /* Adjust the font size */
103
+ text-align: center;
104
+ color: #00ff00; /* Set the text color */
105
+ white-space: pre-wrap; /* Ensures text wraps properly */
106
+ animation: textFlicker 0.05s infinite;
107
+ pointer-events: none;
108
+
109
+ }
110
+
111
+
112
+
113
+ @keyframes textFlicker {
114
+ 0% { text-shadow: 0 0 4px #00ff00; }
115
+ 50% { text-shadow: 0 0 40px #00ff00; }
116
+ 100% { text-shadow: 0 0 4px #00ff00; }
117
+ }
118
+
119
+ /* Terminal Section (2/3) */
120
+ #terminal {
121
+ height: 60.0vh;
122
+ overflow-y: auto;
123
+ padding: 20px;
124
+ scrollbar-width: none;
125
+ -ms-overflow-style: none;
126
+ }
127
+
128
+ #terminal::-webkit-scrollbar {
129
+ display: none;
130
+ }
131
+
132
+ #input-line {
133
+ display: flex;
134
+ align-items: center;
135
+ line-height: 1;
136
+ }
137
+
138
+ #prompt {
139
+ margin-right: 5px;
140
+ line-height: 1;
141
+ }
142
+
143
+ #command-input {
144
+ background: transparent;
145
+ border: none;
146
+ color: #00ff00;
147
+ font-family: inherit;
148
+ font-size: inherit;
149
+ outline: none;
150
+ width: 100%;
151
+ line-height: 1;
152
+ }
153
+
154
+ .output-line {
155
+ margin: 0;
156
+ white-space: pre-wrap;
157
+ display: flex;
158
+ align-items: center;
159
+ line-height: 1;
160
+ }
161
+
162
+ .upload-link {
163
+ color: #00ff00;
164
+ text-decoration: underline;
165
+ cursor: pointer;
166
+ margin-left: 5px;
167
+ line-height: 1;
168
+ }
169
+
170
+ #loading {
171
+ display: none;
172
+ color: #00ff00;
173
+ margin: 0;
174
+ line-height: 1;
175
+ }
176
+
177
+ #loading-blocks .block {
178
+ width: 12px;
179
+ height: 0.6em;
180
+ background-color: #00ff00;
181
+ margin-right: 4px;
182
+ display: inline-block;
183
+ opacity: 0;
184
+ }
185
+
186
+ @keyframes blockSequence {
187
+ 0%, 100% { opacity: 0; }
188
+ 5%, 45% { opacity: 1; }
189
+ 50% { opacity: 0; }
190
+ }
191
+
192
+ #loading-blocks .block:nth-child(1) { animation: blockSequence 6s 0s infinite; }
193
+ #loading-blocks .block:nth-child(2) { animation: blockSequence 6s 0.5s infinite; }
194
+ #loading-blocks .block:nth-child(3) { animation: blockSequence 6s 1s infinite; }
195
+ #loading-blocks .block:nth-child(4) { animation: blockSequence 6s 1.5s infinite; }
196
+ #loading-blocks .block:nth-child(5) { animation: blockSequence 6s 2s infinite; }
197
+ #loading-blocks .block:nth-child(6) { animation: blockSequence 6s 2.5s infinite; }
198
+
199
+ @media (max-height: 658px) {
200
+ .header pre {
201
+ font-size: 90%; /* Reduce font size for smaller heights */
202
+ padding-top:6%;
203
+ padding-bottom: 50px;
204
+
205
+ }
206
+ }
207
+ @media (min-height: 659px) and (max-height: 800px){
208
+ .header pre {
209
+ /* font-size: 110%; */
210
+ font-size: 1rem;
211
+ padding-top:8%;
212
+ padding-bottom: 80px;
213
+
214
+ }
215
+ }
216
+ @media (min-height: 801px) and (max-height: 899px){
217
+ .header pre {
218
+
219
+ font-size: 1.3rem;
220
+ padding-top:8%;
221
+ padding-bottom: 80px;
222
+
223
+ }
224
+ }
225
+ @media (min-height: 900px) {
226
+ .header pre {
227
+
228
+ font-size: 1.5rem;
229
+ padding-top:9%;
230
+ padding-bottom: 7%;
231
+
232
+ }
233
+ }
234
+
235
+
236
+
237
+
238
+
239
+
240
+ </style>
241
+ </head>
242
+ <body>
243
+
244
+
245
+
246
+ <div class="header">
247
+ <pre>
248
+ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“
249
+
250
+
251
+ β–‘β–ˆβ–€β–€β–ˆ β–‘β–ˆβ”€β–‘β–ˆ β–‘β–ˆβ–€β–€β–„ β–€β–ˆβ–€ β–‘β–ˆβ–€β–€β–€β–ˆ γ€€ β–‘β–ˆβ–€β–„β–€β–ˆ β–‘β–ˆβ–€β–€β–€β–ˆ β–‘β–ˆβ–€β–€β–„ β–‘β–ˆβ–€β–€β–€ β–‘β–ˆβ”€β”€β”€ β–‘β–ˆβ–€β–€β–€β–ˆ
252
+ β–‘β–ˆβ–„β–„β–ˆ β–‘β–ˆβ”€β–‘β–ˆ β–‘β–ˆβ”€β–‘β–ˆ β–‘β–ˆβ”€ β–‘β–ˆβ”€β”€β–‘β–ˆ γ€€ β–‘β–ˆβ–‘β–ˆβ–‘β–ˆ β–‘β–ˆβ”€β”€β–‘β–ˆ β–‘β–ˆβ”€β–‘β–ˆ β–‘β–ˆβ–€β–€β–€ β–‘β–ˆβ”€β”€β”€ ─▀▀▀▄▄
253
+ β–‘β–ˆ β–ˆ ─▀▄▄▀ β–‘β–ˆβ–„β–„β–€ β–„β–ˆβ–„ β–‘β–ˆβ–„β–„β–„β–ˆ γ€€ β–‘β–ˆβ”€β”€β–‘β–ˆ β–‘β–ˆβ–„β–„β–„β–ˆ β–‘β–ˆβ–„β–„β–€ β–‘β–ˆβ–„β–„β–„ β–‘β–ˆβ–„β–„β–ˆ β–‘β–ˆβ–„β–„β–„β–ˆ
254
+
255
+ [SYS] Initialized audio processing modules...
256
+ [SYS] Models Loaded Successfully...
257
+ [SYS] System ready for input...
258
+
259
+
260
+ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“
261
+ </pre>
262
+ </div>
263
+
264
+ <div id="terminal">
265
+ <div id="output"></div>
266
+ <div id="loading">
267
+ root@math:~$ Processing
268
+ <span id="loading-blocks">
269
+ <span class="block"></span>
270
+ <span class="block"></span>
271
+ <span class="block"></span>
272
+ <span class="block"></span>
273
+ <span class="block"></span>
274
+ <span class="block"></span>
275
+ </span>
276
+ </div>
277
+ <div id="input-line">
278
+ <span id="prompt">root@math:~$</span>
279
+ <input type="text" id="command-input" autocomplete="off">
280
+ </div>
281
+ <form id="upload-form" style="display: none;">
282
+ <input type="file" id="file-upload" accept=".mp3" style="display: none;">
283
+ </form>
284
+ </div>
285
+
286
+ <script>
287
+ const terminal = document.getElementById('terminal');
288
+ const input = document.getElementById('command-input');
289
+ const output = document.getElementById('output');
290
+ const fileUpload = document.getElementById('file-upload');
291
+ const uploadForm = document.getElementById('upload-form');
292
+ const loading = document.getElementById('loading');
293
+
294
+ input.addEventListener('keypress', async function(e) {
295
+ if (e.key === 'Enter') {
296
+ const command = input.value.trim();
297
+ input.value = '';
298
+
299
+ addOutput(`root@math:~$ ${command}`);
300
+
301
+ if (command.toLowerCase() === 'clear') {
302
+ output.innerHTML = '';
303
+ return;
304
+ }
305
+
306
+ if (!command) {
307
+ addOutput('root@math:~$ Please specify an operation: "classify" or "transcribe".');
308
+ return;
309
+ }
310
+
311
+ try {
312
+ loading.style.display = 'block';
313
+ terminal.scrollTop = terminal.scrollHeight;
314
+
315
+ const response = await fetch('/process', {
316
+ method: 'POST',
317
+ headers: {
318
+ 'Content-Type': 'application/json',
319
+ 'Accept': 'application/json'
320
+ },
321
+ body: JSON.stringify({ command: command })
322
+ });
323
+
324
+ if (!response.ok) {
325
+ throw new Error(`HTTP error! status: ${response.status}`);
326
+ }
327
+
328
+ const data = await response.json();
329
+ if (data.upload) {
330
+ addOutput(`root@math:~$ Upload a .mp3 file for the ${command} operation <span class="upload-link" onclick="document.getElementById('file-upload').click()">[Upload File]</span>`);
331
+ } else {
332
+ addOutput(data.result.split('\n').join('<br>'));
333
+ }
334
+ } catch (error) {
335
+ addOutput(`root@math:~$ Error: ${error.message}`);
336
+ } finally {
337
+ loading.style.display = 'none';
338
+ }
339
+ }
340
+ });
341
+
342
+ fileUpload.addEventListener('change', async function() {
343
+ const file = fileUpload.files[0];
344
+ if (!file) return;
345
+
346
+ const formData = new FormData();
347
+ formData.append('file', file);
348
+
349
+ try {
350
+ loading.style.display = 'block';
351
+ terminal.scrollTop = terminal.scrollHeight;
352
+
353
+ const response = await fetch('/upload', {
354
+ method: 'POST',
355
+ body: formData
356
+ });
357
+
358
+ if (!response.ok) {
359
+ throw new Error(`HTTP error! status: ${response.status}`);
360
+ }
361
+
362
+ const data = await response.json();
363
+ addOutput(data.result.split('\n').join('<br>'));
364
+ } catch (error) {
365
+ addOutput(`root@math:~$ Error: ${error.message}`);
366
+ } finally {
367
+ loading.style.display = 'none';
368
+ fileUpload.value = '';
369
+ }
370
+ });
371
+
372
+ function addOutput(text) {
373
+ const line = document.createElement('div');
374
+ line.className = 'output-line';
375
+ line.innerHTML = text;
376
+ output.appendChild(line);
377
+ terminal.scrollTop = terminal.scrollHeight;
378
+ }
379
+
380
+ // Initial prompt
381
+ addOutput('root@math:~$ Please specify an operation: "classify" or "transcribe".');
382
+
383
+ // Focus input on load and when clicking anywhere in terminal
384
+ input.focus();
385
+ // document.addEventListener('click', (e) => {
386
+ // if (!e.target.classList.contains('upload-link')) {
387
+ // input.focus();
388
+ // }
389
+ // });
390
+ </script>
391
+ </body>
392
+ </html>