Diabolov commited on
Commit
d52bb35
·
verified ·
1 Parent(s): 096a17a

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +403 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Mp4
3
- emoji: 🐨
4
- colorFrom: blue
5
  colorTo: green
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: mp4
3
+ emoji: 🐳
4
+ colorFrom: gray
5
  colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,403 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>HTML to MP4 Converter | WebMagic</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
+ <style>
10
+ .dropzone {
11
+ border: 2px dashed #3b82f6;
12
+ transition: all 0.3s ease;
13
+ }
14
+ .dropzone.active {
15
+ border-color: #10b981;
16
+ background-color: #f0f9ff;
17
+ }
18
+ .progress-bar {
19
+ transition: width 0.5s ease;
20
+ }
21
+ .conversion-animation {
22
+ animation: pulse 2s infinite;
23
+ }
24
+ @keyframes pulse {
25
+ 0%, 100% { opacity: 1; }
26
+ 50% { opacity: 0.7; }
27
+ }
28
+ .file-card:hover {
29
+ transform: translateY(-2px);
30
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
31
+ }
32
+ </style>
33
+ </head>
34
+ <body class="bg-gray-50 min-h-screen">
35
+ <div class="container mx-auto px-4 py-12">
36
+ <!-- Header -->
37
+ <header class="text-center mb-12">
38
+ <h1 class="text-4xl font-bold text-blue-600 mb-3">WebMagic Converter</h1>
39
+ <p class="text-xl text-gray-600">Transform your HTML files into MP4 videos with ease</p>
40
+ <div class="w-24 h-1 bg-blue-500 mx-auto mt-4 rounded-full"></div>
41
+ </header>
42
+
43
+ <!-- Main Converter Section -->
44
+ <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-lg overflow-hidden">
45
+ <div class="md:flex">
46
+ <!-- Left Panel -->
47
+ <div class="md:w-1/2 p-8 bg-gradient-to-br from-blue-50 to-indigo-50">
48
+ <h2 class="text-2xl font-semibold text-gray-800 mb-6">Upload HTML File</h2>
49
+
50
+ <div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6">
51
+ <div class="flex flex-col items-center justify-center">
52
+ <i class="fas fa-file-code text-5xl text-blue-500 mb-4"></i>
53
+ <p class="text-gray-600 mb-2">Drag & drop your HTML file here</p>
54
+ <p class="text-sm text-gray-500">or</p>
55
+ <button id="browseBtn" class="mt-3 px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition">
56
+ Browse Files
57
+ </button>
58
+ </div>
59
+ <input type="file" id="fileInput" class="hidden" accept=".html,.htm">
60
+ </div>
61
+
62
+ <div id="fileInfo" class="hidden bg-white p-4 rounded-lg shadow-sm mb-6">
63
+ <div class="flex items-center">
64
+ <i class="fas fa-file-code text-blue-500 text-2xl mr-3"></i>
65
+ <div>
66
+ <h3 id="fileName" class="font-medium text-gray-800"></h3>
67
+ <p id="fileSize" class="text-sm text-gray-500"></p>
68
+ </div>
69
+ <button id="removeFile" class="ml-auto text-gray-400 hover:text-red-500">
70
+ <i class="fas fa-times"></i>
71
+ </button>
72
+ </div>
73
+ </div>
74
+
75
+ <div class="space-y-4">
76
+ <div>
77
+ <label class="block text-gray-700 mb-2">Resolution</label>
78
+ <select id="resolution" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
79
+ <option value="720p">720p (HD)</option>
80
+ <option value="1080p" selected>1080p (Full HD)</option>
81
+ <option value="4k">4K (Ultra HD)</option>
82
+ </select>
83
+ </div>
84
+
85
+ <div>
86
+ <label class="block text-gray-700 mb-2">Frame Rate</label>
87
+ <select id="fps" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500">
88
+ <option value="24">24 fps</option>
89
+ <option value="30" selected>30 fps</option>
90
+ <option value="60">60 fps</option>
91
+ </select>
92
+ </div>
93
+ </div>
94
+ </div>
95
+
96
+ <!-- Right Panel -->
97
+ <div class="md:w-1/2 p-8">
98
+ <h2 class="text-2xl font-semibold text-gray-800 mb-6">Convert to MP4</h2>
99
+
100
+ <div id="previewSection" class="hidden mb-6">
101
+ <div class="bg-gray-100 rounded-lg p-4 mb-4">
102
+ <div class="flex justify-between items-center mb-2">
103
+ <span class="text-gray-700">Preview</span>
104
+ <button id="refreshPreview" class="text-blue-600 hover:text-blue-800 text-sm">
105
+ <i class="fas fa-sync-alt mr-1"></i> Refresh
106
+ </button>
107
+ </div>
108
+ <div id="htmlPreview" class="bg-white border border-gray-200 rounded h-48 overflow-auto p-2">
109
+ <!-- Preview will be shown here -->
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <div id="conversionSection" class="hidden">
115
+ <div class="mb-4">
116
+ <div class="flex justify-between mb-1">
117
+ <span class="text-sm font-medium text-gray-700">Conversion Progress</span>
118
+ <span id="progressPercent" class="text-sm font-medium text-blue-600">0%</span>
119
+ </div>
120
+ <div class="w-full bg-gray-200 rounded-full h-2.5">
121
+ <div id="progressBar" class="progress-bar bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
122
+ </div>
123
+ </div>
124
+
125
+ <div id="conversionStatus" class="flex items-center p-4 mb-4 text-sm text-blue-700 bg-blue-50 rounded-lg">
126
+ <i class="fas fa-info-circle mr-3"></i>
127
+ <span>Ready to convert your file</span>
128
+ </div>
129
+
130
+ <button id="convertBtn" class="w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-indigo-600 text-white font-medium rounded-lg hover:from-blue-700 hover:to-indigo-700 transition flex items-center justify-center">
131
+ <i class="fas fa-magic mr-2"></i> Convert to MP4
132
+ </button>
133
+ </div>
134
+
135
+ <div id="resultSection" class="hidden mt-6">
136
+ <div class="bg-green-50 border-l-4 border-green-500 p-4 mb-6">
137
+ <div class="flex">
138
+ <div class="flex-shrink-0">
139
+ <i class="fas fa-check-circle text-green-500 text-xl"></i>
140
+ </div>
141
+ <div class="ml-3">
142
+ <p class="text-sm text-green-700">
143
+ Conversion completed successfully! Your MP4 file is ready to download.
144
+ </p>
145
+ </div>
146
+ </div>
147
+ </div>
148
+
149
+ <div class="bg-white border border-gray-200 rounded-lg p-4 mb-6">
150
+ <div class="flex items-center">
151
+ <i class="fas fa-file-video text-indigo-500 text-2xl mr-3"></i>
152
+ <div>
153
+ <h3 id="outputFileName" class="font-medium text-gray-800"></h3>
154
+ <p class="text-sm text-gray-500">MP4 Video File</p>
155
+ </div>
156
+ <button id="downloadBtn" class="ml-auto px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition flex items-center">
157
+ <i class="fas fa-download mr-2"></i> Download
158
+ </button>
159
+ </div>
160
+ </div>
161
+
162
+ <button id="newConversionBtn" class="w-full py-2 px-4 border border-blue-600 text-blue-600 font-medium rounded-lg hover:bg-blue-50 transition">
163
+ <i class="fas fa-plus mr-2"></i> Start New Conversion
164
+ </button>
165
+ </div>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <!-- How It Works Section -->
171
+ <div class="max-w-4xl mx-auto mt-16">
172
+ <h2 class="text-2xl font-bold text-center text-gray-800 mb-8">How It Works</h2>
173
+ <div class="grid md:grid-cols-3 gap-8">
174
+ <div class="bg-white p-6 rounded-xl shadow-md text-center">
175
+ <div class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
176
+ <i class="fas fa-upload text-blue-600 text-2xl"></i>
177
+ </div>
178
+ <h3 class="text-lg font-semibold mb-2">Upload HTML</h3>
179
+ <p class="text-gray-600">Upload your HTML file by dragging and dropping or browsing your files.</p>
180
+ </div>
181
+ <div class="bg-white p-6 rounded-xl shadow-md text-center">
182
+ <div class="w-16 h-16 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-4">
183
+ <i class="fas fa-cog text-indigo-600 text-2xl"></i>
184
+ </div>
185
+ <h3 class="text-lg font-semibold mb-2">Customize Settings</h3>
186
+ <p class="text-gray-600">Select your preferred resolution and frame rate for the output video.</p>
187
+ </div>
188
+ <div class="bg-white p-6 rounded-xl shadow-md text-center">
189
+ <div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
190
+ <i class="fas fa-file-video text-green-600 text-2xl"></i>
191
+ </div>
192
+ <h3 class="text-lg font-semibold mb-2">Download MP4</h3>
193
+ <p class="text-gray-600">Download your converted MP4 file instantly after processing.</p>
194
+ </div>
195
+ </div>
196
+ </div>
197
+
198
+ <!-- Footer -->
199
+ <footer class="mt-16 text-center text-gray-500 text-sm">
200
+ <p>© 2023 WebMagic Converter. All rights reserved.</p>
201
+ <p class="mt-2">This is a client-side demo. For actual HTML to MP4 conversion, server-side processing would be required.</p>
202
+ </footer>
203
+ </div>
204
+
205
+ <script>
206
+ document.addEventListener('DOMContentLoaded', function() {
207
+ // DOM Elements
208
+ const dropzone = document.getElementById('dropzone');
209
+ const fileInput = document.getElementById('fileInput');
210
+ const browseBtn = document.getElementById('browseBtn');
211
+ const fileInfo = document.getElementById('fileInfo');
212
+ const fileName = document.getElementById('fileName');
213
+ const fileSize = document.getElementById('fileSize');
214
+ const removeFile = document.getElementById('removeFile');
215
+ const previewSection = document.getElementById('previewSection');
216
+ const htmlPreview = document.getElementById('htmlPreview');
217
+ const refreshPreview = document.getElementById('refreshPreview');
218
+ const conversionSection = document.getElementById('conversionSection');
219
+ const convertBtn = document.getElementById('convertBtn');
220
+ const progressBar = document.getElementById('progressBar');
221
+ const progressPercent = document.getElementById('progressPercent');
222
+ const conversionStatus = document.getElementById('conversionStatus');
223
+ const resultSection = document.getElementById('resultSection');
224
+ const outputFileName = document.getElementById('outputFileName');
225
+ const downloadBtn = document.getElementById('downloadBtn');
226
+ const newConversionBtn = document.getElementById('newConversionBtn');
227
+
228
+ let uploadedFile = null;
229
+ let objectUrl = null;
230
+
231
+ // Event Listeners
232
+ browseBtn.addEventListener('click', () => fileInput.click());
233
+ fileInput.addEventListener('change', handleFileSelect);
234
+ dropzone.addEventListener('dragover', handleDragOver);
235
+ dropzone.addEventListener('dragleave', handleDragLeave);
236
+ dropzone.addEventListener('drop', handleDrop);
237
+ removeFile.addEventListener('click', resetFileInput);
238
+ refreshPreview.addEventListener('click', displayFilePreview);
239
+ convertBtn.addEventListener('click', startConversion);
240
+ downloadBtn.addEventListener('click', downloadFile);
241
+ newConversionBtn.addEventListener('click', resetConverter);
242
+
243
+ // Functions
244
+ function handleFileSelect(e) {
245
+ const file = e.target.files[0];
246
+ if (file && file.name.endsWith('.html') || file.name.endsWith('.htm')) {
247
+ processFile(file);
248
+ } else {
249
+ showError('Please select a valid HTML file (.html or .htm)');
250
+ }
251
+ }
252
+
253
+ function handleDragOver(e) {
254
+ e.preventDefault();
255
+ dropzone.classList.add('active');
256
+ }
257
+
258
+ function handleDragLeave() {
259
+ dropzone.classList.remove('active');
260
+ }
261
+
262
+ function handleDrop(e) {
263
+ e.preventDefault();
264
+ dropzone.classList.remove('active');
265
+
266
+ const file = e.dataTransfer.files[0];
267
+ if (file && file.name.endsWith('.html') || file.name.endsWith('.htm')) {
268
+ processFile(file);
269
+ } else {
270
+ showError('Please drop a valid HTML file (.html or .htm)');
271
+ }
272
+ }
273
+
274
+ function processFile(file) {
275
+ uploadedFile = file;
276
+
277
+ // Display file info
278
+ fileName.textContent = file.name;
279
+ fileSize.textContent = formatFileSize(file.size);
280
+ fileInfo.classList.remove('hidden');
281
+ previewSection.classList.remove('hidden');
282
+ conversionSection.classList.remove('hidden');
283
+
284
+ // Display preview
285
+ displayFilePreview();
286
+
287
+ // Update conversion status
288
+ conversionStatus.innerHTML = `<i class="fas fa-check-circle mr-3 text-green-500"></i><span>File "${file.name}" ready for conversion</span>`;
289
+ conversionStatus.classList.remove('bg-blue-50', 'text-blue-700');
290
+ conversionStatus.classList.add('bg-green-50', 'text-green-700');
291
+ }
292
+
293
+ function displayFilePreview() {
294
+ if (!uploadedFile) return;
295
+
296
+ if (objectUrl) {
297
+ URL.revokeObjectURL(objectUrl);
298
+ }
299
+
300
+ objectUrl = URL.createObjectURL(uploadedFile);
301
+
302
+ // For demo purposes, we'll show a message about the preview
303
+ // In a real app, you might use an iframe to show the HTML content
304
+ htmlPreview.innerHTML = `
305
+ <div class="text-center p-4">
306
+ <i class="fas fa-file-code text-3xl text-blue-400 mb-2"></i>
307
+ <p class="font-medium">${uploadedFile.name}</p>
308
+ <p class="text-sm text-gray-500 mt-1">HTML file preview would be displayed here in a full implementation</p>
309
+ </div>
310
+ `;
311
+ }
312
+
313
+ function startConversion() {
314
+ if (!uploadedFile) {
315
+ showError('Please select a file first');
316
+ return;
317
+ }
318
+
319
+ // Simulate conversion process
320
+ convertBtn.disabled = true;
321
+ convertBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Converting...';
322
+ conversionStatus.innerHTML = '<i class="fas fa-cog fa-spin mr-3"></i> Converting your HTML to MP4...';
323
+ conversionStatus.classList.remove('bg-green-50', 'text-green-700');
324
+ conversionStatus.classList.add('bg-blue-50', 'text-blue-700');
325
+
326
+ let progress = 0;
327
+ const interval = setInterval(() => {
328
+ progress += Math.random() * 10;
329
+ if (progress > 100) progress = 100;
330
+
331
+ progressBar.style.width = `${progress}%`;
332
+ progressPercent.textContent = `${Math.round(progress)}%`;
333
+
334
+ if (progress === 100) {
335
+ clearInterval(interval);
336
+ conversionComplete();
337
+ }
338
+ }, 300);
339
+ }
340
+
341
+ function conversionComplete() {
342
+ convertBtn.classList.add('hidden');
343
+ resultSection.classList.remove('hidden');
344
+
345
+ const outputName = uploadedFile.name.replace('.html', '.mp4').replace('.htm', '.mp4');
346
+ outputFileName.textContent = outputName;
347
+
348
+ conversionStatus.innerHTML = '<i class="fas fa-check-circle mr-3 text-green-500"></i> Conversion completed successfully!';
349
+ conversionStatus.classList.remove('bg-blue-50', 'text-blue-700');
350
+ conversionStatus.classList.add('bg-green-50', 'text-green-700');
351
+ }
352
+
353
+ function downloadFile() {
354
+ // In a real implementation, this would download the converted file
355
+ // For demo purposes, we'll show a success message
356
+ alert('In a real implementation, this would download the converted MP4 file.\n\nFor this demo, no actual conversion happens client-side.');
357
+ }
358
+
359
+ function resetConverter() {
360
+ resetFileInput();
361
+ resultSection.classList.add('hidden');
362
+ convertBtn.classList.remove('hidden');
363
+ convertBtn.disabled = false;
364
+ convertBtn.innerHTML = '<i class="fas fa-magic mr-2"></i> Convert to MP4';
365
+ progressBar.style.width = '0%';
366
+ progressPercent.textContent = '0%';
367
+
368
+ conversionStatus.innerHTML = '<i class="fas fa-info-circle mr-3"></i><span>Ready to convert your file</span>';
369
+ conversionStatus.classList.remove('bg-green-50', 'text-green-700');
370
+ conversionStatus.classList.add('bg-blue-50', 'text-blue-700');
371
+ }
372
+
373
+ function resetFileInput() {
374
+ if (objectUrl) {
375
+ URL.revokeObjectURL(objectUrl);
376
+ objectUrl = null;
377
+ }
378
+
379
+ uploadedFile = null;
380
+ fileInput.value = '';
381
+ fileInfo.classList.add('hidden');
382
+ previewSection.classList.add('hidden');
383
+ conversionSection.classList.add('hidden');
384
+ htmlPreview.innerHTML = '';
385
+ }
386
+
387
+ function showError(message) {
388
+ conversionStatus.innerHTML = `<i class="fas fa-exclamation-circle mr-3 text-red-500"></i><span>${message}</span>`;
389
+ conversionStatus.classList.remove('bg-blue-50', 'text-blue-700', 'bg-green-50', 'text-green-700');
390
+ conversionStatus.classList.add('bg-red-50', 'text-red-700');
391
+ }
392
+
393
+ function formatFileSize(bytes) {
394
+ if (bytes === 0) return '0 Bytes';
395
+ const k = 1024;
396
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
397
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
398
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
399
+ }
400
+ });
401
+ </script>
402
+ <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://enzostvs-deepsite.hf.space/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://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Diabolov/mp4" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
403
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ create a HTML to MP4 converter