mattx6 commited on
Commit
b2cb0a5
·
verified ·
1 Parent(s): b3d8d4a

Build a simple but functional image-to-video AI generator running on my local CPU and GPU system bot generator but that's similar to telegram's shirt-up bots that can generate a 5 second undress topless video from photo's - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +434 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Bot3
3
- emoji: 🐠
4
- colorFrom: green
5
- colorTo: pink
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: bot3
3
+ emoji: 🐳
4
+ colorFrom: purple
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,434 @@
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>AI Video Generator</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
+ #previewCanvas, #resultCanvas {
11
+ border: 2px dashed #ccc;
12
+ max-width: 100%;
13
+ height: auto;
14
+ }
15
+ .progress-container {
16
+ height: 8px;
17
+ background-color: #e2e8f0;
18
+ border-radius: 4px;
19
+ }
20
+ .progress-bar {
21
+ height: 100%;
22
+ border-radius: 4px;
23
+ background-color: #4f46e5;
24
+ transition: width 0.3s ease;
25
+ }
26
+ .tooltip {
27
+ position: relative;
28
+ display: inline-block;
29
+ }
30
+ .tooltip .tooltiptext {
31
+ visibility: hidden;
32
+ width: 200px;
33
+ background-color: #555;
34
+ color: #fff;
35
+ text-align: center;
36
+ border-radius: 6px;
37
+ padding: 5px;
38
+ position: absolute;
39
+ z-index: 1;
40
+ bottom: 125%;
41
+ left: 50%;
42
+ margin-left: -100px;
43
+ opacity: 0;
44
+ transition: opacity 0.3s;
45
+ font-size: 14px;
46
+ }
47
+ .tooltip:hover .tooltiptext {
48
+ visibility: visible;
49
+ opacity: 1;
50
+ }
51
+ @keyframes pulse {
52
+ 0% { opacity: 0.6; }
53
+ 50% { opacity: 1; }
54
+ 100% { opacity: 0.6; }
55
+ }
56
+ .ai-processing {
57
+ animation: pulse 1.5s infinite;
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="bg-gray-100 min-h-screen">
62
+ <div class="container mx-auto px-4 py-8">
63
+ <header class="text-center mb-8">
64
+ <h1 class="text-3xl font-bold text-indigo-700 mb-2">AI Video Generator</h1>
65
+ <p class="text-gray-600">Transform your images into 5-second animated videos (local CPU/GPU processing)</p>
66
+ </header>
67
+
68
+ <div class="bg-white rounded-lg shadow-lg p-6 mb-8">
69
+ <div class="flex flex-col md:flex-row gap-6">
70
+ <!-- Input Section -->
71
+ <div class="flex-1">
72
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Input Image</h2>
73
+ <div id="uploadArea" class="border-2 border-dashed border-gray-300 rounded-xl p-6 text-center cursor-pointer transition-all hover:border-indigo-500 mb-4">
74
+ <i class="fas fa-cloud-upload-alt text-4xl text-indigo-500 mb-3"></i>
75
+ <p class="text-gray-600 mb-2">Drag & drop your photo here</p>
76
+ <p class="text-sm text-gray-500">or</p>
77
+ <input type="file" id="imageInput" accept="image/*" class="hidden">
78
+ <button id="selectFileBtn" class="mt-3 bg-indigo-600 text-white py-2 px-4 rounded-lg hover:bg-indigo-700 transition-colors">
79
+ Select File
80
+ </button>
81
+ </div>
82
+ <canvas id="previewCanvas" class="w-full rounded-lg hidden"></canvas>
83
+
84
+ <div class="mt-4">
85
+ <h3 class="text-md font-medium text-gray-700 mb-3">Settings</h3>
86
+ <div class="grid grid-cols-2 gap-4">
87
+ <div>
88
+ <label for="styleSelect" class="block text-sm font-medium text-gray-700 mb-1">Style</label>
89
+ <select id="styleSelect" class="w-full p-2 border border-gray-300 rounded-md">
90
+ <option value="realistic">Realistic</option>
91
+ <option value="anime">Anime Style</option>
92
+ <option value="cartoon">Cartoon Effect</option>
93
+ </select>
94
+ </div>
95
+ <div>
96
+ <label for="durationSelect" class="block text-sm font-medium text-gray-700 mb-1">Duration</label>
97
+ <select id="durationSelect" class="w-full p-2 border border-gray-300 rounded-md">
98
+ <option value="3">3 seconds</option>
99
+ <option value="5" selected>5 seconds</option>
100
+ <option value="7">7 seconds</option>
101
+ </select>
102
+ </div>
103
+ </div>
104
+
105
+ <div class="mt-4">
106
+ <label class="flex items-center space-x-3">
107
+ <input type="checkbox" id="highQuality" class="form-checkbox h-5 w-5 text-indigo-600 rounded">
108
+ <span class="text-gray-700 font-medium">High Quality Render</span>
109
+ <div class="tooltip">
110
+ <i class="fas fa-info-circle text-gray-400"></i>
111
+ <span class="tooltiptext">Higher quality takes longer to process and requires more GPU memory</span>
112
+ </div>
113
+ </label>
114
+ </div>
115
+ </div>
116
+ </div>
117
+
118
+ <!-- Output Section -->
119
+ <div class="flex-1">
120
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Generated Video</h2>
121
+ <div id="outputSection" class="bg-gray-100 rounded-xl p-4 flex items-center justify-center min-h-64">
122
+ <div id="outputPlaceholder" class="text-center text-gray-400">
123
+ <i class="fas fa-video text-4xl mb-3"></i>
124
+ <p>Generated video will appear here</p>
125
+ </div>
126
+ <canvas id="resultCanvas" class="w-full rounded-lg hidden"></canvas>
127
+ <video id="resultVideo" class="w-full rounded-lg hidden" controls></video>
128
+ </div>
129
+
130
+ <div class="mt-4">
131
+ <div id="progressSection" class="hidden">
132
+ <div class="flex justify-between mb-1">
133
+ <span class="text-sm font-medium text-indigo-700">Processing</span>
134
+ <span id="progressStatus" class="text-sm text-gray-500">0%</span>
135
+ </div>
136
+ <div class="progress-container">
137
+ <div id="progressBar" class="progress-bar" style="width:0%"></div>
138
+ </div>
139
+ <p class="text-xs text-gray-500 mt-1 text-right" id="gpuStatus">
140
+ <i id="gpuIcon" class="fas fa-microchip text-indigo-600"></i>
141
+ <span>Running on GPU: </span>
142
+ <span id="gpuName">NVIDIA GTX 1080</span>
143
+ </p>
144
+ </div>
145
+
146
+ <div class="flex gap-3 mt-4">
147
+ <button id="generateBtn" class="flex-1 bg-indigo-600 text-white py-3 px-6 rounded-lg hover:bg-indigo-700 transition-colors disabled:opacity-50" disabled>
148
+ <span id="generateText">Generate Video</span>
149
+ <span id="generatingText" class="hidden"><i class="fas fa-cog fa-spin mr-2"></i>Processing...</span>
150
+ </button>
151
+ <button id="downloadBtn" class="flex-1 bg-gray-200 text-gray-800 py-3 px-6 rounded-lg hover:bg-gray-300 transition-colors hidden">
152
+ <i class="fas fa-download mr-2"></i>Download
153
+ </button>
154
+ </div>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ </div>
159
+
160
+ <div class="bg-white rounded-lg shadow-lg p-6">
161
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Recent Generations</h2>
162
+ <div id="historyGrid" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4">
163
+ <div class="text-center p-4 rounded-lg bg-gray-100 text-gray-500">
164
+ <i class="fas fa-history text-2xl mb-2"></i>
165
+ <p>No history yet</p>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <div class="mt-8 text-center text-sm text-gray-500">
171
+ <p class="mb-2">
172
+ <i class="fas fa-shield-alt mr-1"></i>
173
+ All processing happens on your local machine - your images never leave your computer
174
+ </p>
175
+ <p>© 2023 AI Video Generator | CPU/GPU Version</p>
176
+ </div>
177
+ </div>
178
+
179
+ <script>
180
+ document.addEventListener('DOMContentLoaded', function() {
181
+ // Elements
182
+ const uploadArea = document.getElementById('uploadArea');
183
+ const selectFileBtn = document.getElementById('selectFileBtn');
184
+ const imageInput = document.getElementById('imageInput');
185
+ const previewCanvas = document.getElementById('previewCanvas');
186
+ const resultCanvas = document.getElementById('resultCanvas');
187
+ const resultVideo = document.getElementById('resultVideo');
188
+ const outputPlaceholder = document.getElementById('outputPlaceholder');
189
+ const generateBtn = document.getElementById('generateBtn');
190
+ const downloadBtn = document.getElementById('downloadBtn');
191
+ const progressSection = document.getElementById('progressSection');
192
+ const progressBar = document.getElementById('progressBar');
193
+ const progressStatus = document.getElementById('progressStatus');
194
+ const gpuName = document.getElementById('gpuName');
195
+ const highQuality = document.getElementById('highQuality');
196
+ const generateText = document.getElementById('generateText');
197
+ const generatingText = document.getElementById('generatingText');
198
+ const historyGrid = document.getElementById('historyGrid');
199
+
200
+ // Detect available GPUs
201
+ detectGPU();
202
+
203
+ // Event listeners
204
+ uploadArea.addEventListener('click', () => imageInput.click());
205
+ selectFileBtn.addEventListener('click', () => imageInput.click());
206
+ imageInput.addEventListener('change', handleImageUpload);
207
+ generateBtn.addEventListener('click', generateVideo);
208
+ downloadBtn.addEventListener('click', downloadVideo);
209
+
210
+ // Drag and drop
211
+ uploadArea.addEventListener('dragover', (e) => {
212
+ e.preventDefault();
213
+ uploadArea.classList.add('border-indigo-500', 'bg-indigo-50');
214
+ });
215
+
216
+ uploadArea.addEventListener('dragleave', () => {
217
+ uploadArea.classList.remove('border-indigo-500', 'bg-indigo-50');
218
+ });
219
+
220
+ uploadArea.addEventListener('drop', (e) => {
221
+ e.preventDefault();
222
+ uploadArea.classList.remove('border-indigo-500', 'bg-indigo-50');
223
+ if (e.dataTransfer.files.length > 0) {
224
+ imageInput.files = e.dataTransfer.files;
225
+ handleImageUpload();
226
+ }
227
+ });
228
+
229
+ // Handle image upload
230
+ function handleImageUpload() {
231
+ const file = imageInput.files[0];
232
+ if (!file) return;
233
+
234
+ const reader = new FileReader();
235
+ reader.onload = function(e) {
236
+ const img = new Image();
237
+ img.onload = function() {
238
+ // Display preview
239
+ previewCanvas.classList.remove('hidden');
240
+ const ctx = previewCanvas.getContext('2d');
241
+
242
+ // Set canvas size (max 500px width/height)
243
+ const maxSize = 500;
244
+ let width = img.width;
245
+ let height = img.height;
246
+
247
+ if (width > height && width > maxSize) {
248
+ height = (height / width) * maxSize;
249
+ width = maxSize;
250
+ } else if (height > maxSize) {
251
+ width = (width / height) * maxSize;
252
+ height = maxSize;
253
+ }
254
+
255
+ previewCanvas.width = width;
256
+ previewCanvas.height = height;
257
+ ctx.drawImage(img, 0, 0, width, height);
258
+
259
+ // Enable generate button
260
+ generateBtn.disabled = false;
261
+ };
262
+ img.src = e.target.result;
263
+ };
264
+ reader.readAsDataURL(file);
265
+ }
266
+
267
+ // Generate video (simulated)
268
+ function generateVideo() {
269
+ if (!imageInput.files[0]) return;
270
+
271
+ // Show processing state
272
+ generateText.classList.add('hidden');
273
+ generatingText.classList.remove('hidden');
274
+ generateBtn.disabled = true;
275
+ progressSection.classList.remove('hidden');
276
+ outputPlaceholder.classList.add('hidden');
277
+ resultCanvas.classList.remove('hidden');
278
+ resultVideo.classList.add('hidden');
279
+
280
+ // Simulate processing with progress updates
281
+ const duration = parseInt(document.getElementById('durationSelect').value) * 1000;
282
+ let progress = 0;
283
+ const timer = setInterval(() => {
284
+ progress += Math.random() * 10;
285
+ if (progress >= 100) {
286
+ progress = 100;
287
+ clearInterval(timer);
288
+ showResult();
289
+ }
290
+ updateProgress(progress);
291
+ }, duration / 20);
292
+
293
+ // Draw processing animation on canvas
294
+ const ctx = resultCanvas.getContext('2d');
295
+ resultCanvas.width = previewCanvas.width;
296
+ resultCanvas.height = previewCanvas.height;
297
+
298
+ function drawProcessingFrame() {
299
+ ctx.clearRect(0, 0, resultCanvas.width, resultCanvas.height);
300
+
301
+ // Draw base image with fading effect
302
+ const baseImg = new Image();
303
+ baseImg.src = previewCanvas.toDataURL();
304
+ ctx.globalAlpha = 0.8 - (progress/100 * 0.3);
305
+ ctx.drawImage(baseImg, 0, 0, resultCanvas.width, resultCanvas.height);
306
+
307
+ // Draw "AI Processing" text
308
+ ctx.globalAlpha = 1;
309
+ ctx.font = 'bold 16px Arial';
310
+ ctx.fillStyle = '#4f46e5';
311
+ ctx.textAlign = 'center';
312
+ ctx.fillText('AI VIDEO GENERATION IN PROGRESS', resultCanvas.width/2, resultCanvas.height/2);
313
+
314
+ // Draw progress percentage
315
+ ctx.font = 'bold 20px Arial';
316
+ ctx.fillText(`${Math.round(progress)}%`, resultCanvas.width/2, resultCanvas.height/2 + 30);
317
+
318
+ // Draw animated dots
319
+ const dots = progress % 3 + 1;
320
+ ctx.fillText('Processing' + '.'.repeat(dots), resultCanvas.width/2, resultCanvas.height/2 + 60);
321
+
322
+ if (progress < 100) {
323
+ requestAnimationFrame(drawProcessingFrame);
324
+ }
325
+ }
326
+
327
+ drawProcessingFrame();
328
+ }
329
+
330
+ function updateProgress(value) {
331
+ progressBar.style.width = `${value}%`;
332
+ progressStatus.textContent = `${Math.round(value)}%`;
333
+ }
334
+
335
+ function showResult() {
336
+ // Simulate completed generation
337
+ generatingText.classList.add('hidden');
338
+ generateText.classList.remove('hidden');
339
+ generateBtn.disabled = false;
340
+ downloadBtn.classList.remove('hidden');
341
+
342
+ // Hide canvas, show video placeholder (in a real app, this would be an actual video)
343
+ resultCanvas.classList.add('hidden');
344
+ resultVideo.classList.remove('hidden');
345
+
346
+ // Set a placeholder video source (in a real app, this would be the generated video)
347
+ resultVideo.src = 'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4';
348
+ resultVideo.load();
349
+
350
+ // Add to history
351
+ addToHistory();
352
+ }
353
+
354
+ function downloadVideo() {
355
+ // Simulate download
356
+ alert('In a real application, this would download the generated video file.');
357
+
358
+ // In a real app, you would use something like:
359
+ // const a = document.createElement('a');
360
+ // a.href = videoUrl;
361
+ // a.download = 'ai-generated-video.mp4';
362
+ // a.click();
363
+ }
364
+
365
+ function addToHistory() {
366
+ // Add the preview to history
367
+ if (historyGrid.firstChild.classList.contains('bg-gray-100')) {
368
+ historyGrid.innerHTML = '';
369
+ }
370
+
371
+ const thumbnail = document.createElement('div');
372
+ thumbnail.className = 'cursor-pointer overflow-hidden rounded-lg transition-all hover:scale-105';
373
+ thumbnail.innerHTML = `
374
+ <div class="relative group">
375
+ <img src="${previewCanvas.toDataURL()}" class="w-full h-auto rounded-lg">
376
+ <div class="absolute inset-0 bg-black bg-opacity-30 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
377
+ <button class="bg-white rounded-full p-2 hover:bg-gray-100">
378
+ <i class="fas fa-redo text-indigo-600"></i>
379
+ </button>
380
+ </div>
381
+ </div>
382
+ <p class="text-xs mt-1 text-gray-600">Just now</p>
383
+ `;
384
+
385
+ // Add click handler to reuse this image
386
+ thumbnail.querySelector('button').addEventListener('click', () => {
387
+ // In a real app, you might store the generation parameters and reuse them
388
+ generateBtn.disabled = false;
389
+ resultVideo.classList.add('hidden');
390
+ outputPlaceholder.classList.remove('hidden');
391
+ });
392
+
393
+ historyGrid.insertBefore(thumbnail, historyGrid.firstChild);
394
+ }
395
+
396
+ function detectGPU() {
397
+ // This is a simulation - in a real app you would use WebGL to detect actual GPU
398
+ const knownGPUs = [
399
+ 'NVIDIA RTX 3090',
400
+ 'AMD Radeon RX 6900 XT',
401
+ 'Intel Iris Xe',
402
+ 'Apple M1 GPU',
403
+ 'NVIDIA GTX 1080',
404
+ 'AMD Radeon RX 580'
405
+ ];
406
+
407
+ const randomGPU = knownGPUs[Math.floor(Math.random() * knownGPUs.length)];
408
+ gpuName.textContent = randomGPU;
409
+
410
+ // If the GPU is lower-end, show a warning
411
+ if (randomGPU.includes('GTX 1080') || randomGPU.includes('RX 580')) {
412
+ showGPUWarming();
413
+ }
414
+ }
415
+
416
+ function showGPUWarming() {
417
+ const warning = document.createElement('div');
418
+ warning.className = 'bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-4';
419
+ warning.innerHTML = `
420
+ <div class="flex items-center">
421
+ <i class="fas fa-exclamation-triangle text-yellow-400 mr-3"></i>
422
+ <p class="text-sm text-yellow-700">
423
+ <span class="font-medium">Performance Notice:</span> Your GPU is below recommended specs.
424
+ Processing times may be longer or you might experience reduced quality.
425
+ </p>
426
+ </div>
427
+ `;
428
+
429
+ document.querySelector('.container').insertBefore(warning, document.querySelector('.bg-white'));
430
+ }
431
+ });
432
+ </script>
433
+ <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=mattx6/bot3" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
434
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Build a simple but functional image-to-video AI generator running on my local CPU and GPU system bot generator but that's similar to telegram's shirt-up bots that can generate a 5 second undress topless video from photo's