vishnumeher commited on
Commit
32e8426
·
verified ·
1 Parent(s): da30d45

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +327 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Mem
3
- emoji: 🏃
4
- colorFrom: yellow
5
- colorTo: gray
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: mem
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: purple
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,327 @@
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>Memories Gallery</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
+ .gallery-container {
11
+ position: relative;
12
+ overflow: hidden;
13
+ height: 80vh;
14
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
15
+ border-radius: 16px;
16
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
17
+ }
18
+
19
+ .gallery-track {
20
+ display: flex;
21
+ transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
22
+ height: 100%;
23
+ }
24
+
25
+ .memory-slide {
26
+ min-width: 100%;
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ position: relative;
31
+ padding: 20px;
32
+ box-sizing: border-box;
33
+ }
34
+
35
+ .memory-image {
36
+ max-width: 100%;
37
+ max-height: 100%;
38
+ object-fit: contain;
39
+ border-radius: 12px;
40
+ box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
41
+ transition: transform 0.3s ease;
42
+ }
43
+
44
+ .memory-image:hover {
45
+ transform: scale(1.02);
46
+ }
47
+
48
+ .memory-info {
49
+ position: absolute;
50
+ bottom: 30px;
51
+ left: 50%;
52
+ transform: translateX(-50%);
53
+ background: rgba(255, 255, 255, 0.9);
54
+ color: #333;
55
+ padding: 12px 24px;
56
+ border-radius: 30px;
57
+ font-size: 1rem;
58
+ font-weight: 600;
59
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
60
+ }
61
+
62
+ .gallery-nav {
63
+ position: absolute;
64
+ bottom: 20px;
65
+ left: 50%;
66
+ transform: translateX(-50%);
67
+ display: flex;
68
+ gap: 12px;
69
+ z-index: 10;
70
+ }
71
+
72
+ .nav-dot {
73
+ width: 10px;
74
+ height: 10px;
75
+ border-radius: 50%;
76
+ background: rgba(255, 255, 255, 0.6);
77
+ border: 2px solid rgba(255, 255, 255, 0.8);
78
+ cursor: pointer;
79
+ transition: all 0.3s ease;
80
+ }
81
+
82
+ .nav-dot.active {
83
+ background: white;
84
+ transform: scale(1.3);
85
+ border-color: white;
86
+ }
87
+
88
+ .loading-overlay {
89
+ position: absolute;
90
+ top: 0;
91
+ left: 0;
92
+ width: 100%;
93
+ height: 100%;
94
+ background: rgba(255, 255, 255, 0.8);
95
+ display: flex;
96
+ flex-direction: column;
97
+ justify-content: center;
98
+ align-items: center;
99
+ z-index: 100;
100
+ }
101
+
102
+ .spinner {
103
+ width: 50px;
104
+ height: 50px;
105
+ border: 5px solid rgba(0, 0, 0, 0.1);
106
+ border-radius: 50%;
107
+ border-top-color: #4f46e5;
108
+ animation: spin 1s ease-in-out infinite;
109
+ margin-bottom: 20px;
110
+ }
111
+
112
+ @keyframes spin {
113
+ to { transform: rotate(360deg); }
114
+ }
115
+
116
+ @media (max-width: 768px) {
117
+ .gallery-container {
118
+ height: 60vh;
119
+ }
120
+
121
+ .memory-info {
122
+ font-size: 0.9rem;
123
+ padding: 8px 16px;
124
+ bottom: 20px;
125
+ }
126
+ }
127
+ </style>
128
+ </head>
129
+ <body class="bg-gray-50 min-h-screen flex flex-col items-center justify-center p-4">
130
+ <div class="w-full max-w-6xl mx-auto">
131
+ <h1 class="text-4xl md:text-5xl font-bold text-center mb-8 text-gray-800">
132
+ <span class="text-indigo-600">Memories</span> Gallery
133
+ </h1>
134
+
135
+ <div class="gallery-container">
136
+ <div class="loading-overlay">
137
+ <div class="spinner"></div>
138
+ <p class="text-gray-700 font-medium">Loading your memories...</p>
139
+ </div>
140
+
141
+ <div class="gallery-track"></div>
142
+
143
+ <div class="gallery-nav"></div>
144
+ </div>
145
+ </div>
146
+
147
+ <script>
148
+ document.addEventListener('DOMContentLoaded', function() {
149
+ const galleryTrack = document.querySelector('.gallery-track');
150
+ const galleryNav = document.querySelector('.gallery-nav');
151
+ const loadingOverlay = document.querySelector('.loading-overlay');
152
+
153
+ let currentSlide = 0;
154
+ let slideInterval;
155
+ const slideDuration = 4000; // 4 seconds per slide
156
+ let imageFiles = [];
157
+
158
+ // Function to get all image files from the same directory
159
+ async function loadImagesFromDirectory() {
160
+ try {
161
+ // This will only work if the HTML file is served from a web server
162
+ const response = await fetch(window.location.href);
163
+ const html = await response.text();
164
+
165
+ // Parse HTML to find image files (simplified approach)
166
+ // Note: This is a basic implementation and may not catch all images
167
+ const parser = new DOMParser();
168
+ const doc = parser.parseFromString(html, 'text/html');
169
+ const images = doc.querySelectorAll('img');
170
+
171
+ // Get all image files in the same directory
172
+ const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp'];
173
+ const directoryPath = window.location.href.substring(0, window.location.href.lastIndexOf('/') + 1);
174
+
175
+ // In a real scenario, you would need server-side code to list files
176
+ // For this demo, we'll use a placeholder approach
177
+ console.log("Note: In a real implementation, you would need server-side code to list all image files in the directory.");
178
+
179
+ // For demo purposes, we'll create some placeholder images
180
+ // Replace this with actual image loading logic for your implementation
181
+ const placeholderImages = [
182
+ { name: 'memory1.jpg', caption: 'Beautiful Day' },
183
+ { name: 'memory2.jpg', caption: 'Family Gathering' },
184
+ { name: 'memory3.jpg', caption: 'Vacation Time' },
185
+ { name: 'memory4.jpg', caption: 'Special Moment' },
186
+ { name: 'memory5.jpg', caption: 'Celebration' }
187
+ ];
188
+
189
+ return placeholderImages.map(img => {
190
+ return {
191
+ url: img.name,
192
+ caption: img.caption
193
+ };
194
+ });
195
+
196
+ } catch (error) {
197
+ console.error("Error loading images:", error);
198
+ return [];
199
+ }
200
+ }
201
+
202
+ // Initialize gallery
203
+ async function initGallery() {
204
+ // Load images from the same directory
205
+ imageFiles = await loadImagesFromDirectory();
206
+
207
+ if (imageFiles.length === 0) {
208
+ loadingOverlay.innerHTML = `
209
+ <div class="text-center p-6">
210
+ <i class="fas fa-image text-4xl text-gray-400 mb-4"></i>
211
+ <h3 class="text-xl font-medium text-gray-700">No images found</h3>
212
+ <p class="text-gray-600 mt-2">Place your image files in the same folder as this HTML file</p>
213
+ </div>
214
+ `;
215
+ return;
216
+ }
217
+
218
+ // Create slides
219
+ imageFiles.forEach((image, index) => {
220
+ // Create slide element
221
+ const slide = document.createElement('div');
222
+ slide.className = 'memory-slide';
223
+
224
+ // Create image element
225
+ const img = document.createElement('img');
226
+ img.src = image.url;
227
+ img.alt = image.caption || `Memory ${index + 1}`;
228
+ img.className = 'memory-image';
229
+ img.loading = 'lazy';
230
+
231
+ // Create caption element
232
+ const caption = document.createElement('div');
233
+ caption.className = 'memory-info';
234
+ caption.textContent = image.caption || `Memory ${index + 1}`;
235
+
236
+ // Append elements
237
+ slide.appendChild(img);
238
+ slide.appendChild(caption);
239
+ galleryTrack.appendChild(slide);
240
+
241
+ // Create navigation dot
242
+ const navDot = document.createElement('div');
243
+ navDot.className = 'nav-dot';
244
+ navDot.dataset.index = index;
245
+ navDot.addEventListener('click', () => goToSlide(index));
246
+ galleryNav.appendChild(navDot);
247
+ });
248
+
249
+ // Hide loading overlay
250
+ loadingOverlay.style.display = 'none';
251
+
252
+ // Set initial active state
253
+ updateNavDots();
254
+
255
+ // Start auto-sliding
256
+ startSlideShow();
257
+ }
258
+
259
+ // Start auto-sliding
260
+ function startSlideShow() {
261
+ slideInterval = setInterval(nextSlide, slideDuration);
262
+ }
263
+
264
+ // Go to specific slide
265
+ function goToSlide(index) {
266
+ currentSlide = index;
267
+ updateSliderPosition();
268
+ updateNavDots();
269
+ }
270
+
271
+ // Go to next slide
272
+ function nextSlide() {
273
+ currentSlide = (currentSlide + 1) % imageFiles.length;
274
+ updateSliderPosition();
275
+ updateNavDots();
276
+ }
277
+
278
+ // Update slider position
279
+ function updateSliderPosition() {
280
+ const slideWidth = 100; // percentage
281
+ galleryTrack.style.transform = `translateX(-${currentSlide * slideWidth}%)`;
282
+ }
283
+
284
+ // Update navigation dots
285
+ function updateNavDots() {
286
+ const navDots = document.querySelectorAll('.nav-dot');
287
+ navDots.forEach((dot, index) => {
288
+ if (index === currentSlide) {
289
+ dot.classList.add('active');
290
+ } else {
291
+ dot.classList.remove('active');
292
+ }
293
+ });
294
+ }
295
+
296
+ // Touch events for mobile swipe
297
+ let touchStartX = 0;
298
+ let touchEndX = 0;
299
+
300
+ galleryTrack.addEventListener('touchstart', (e) => {
301
+ touchStartX = e.changedTouches[0].screenX;
302
+ }, { passive: true });
303
+
304
+ galleryTrack.addEventListener('touchend', (e) => {
305
+ touchEndX = e.changedTouches[0].screenX;
306
+ handleSwipe();
307
+ }, { passive: true });
308
+
309
+ function handleSwipe() {
310
+ const threshold = 50; // minimum swipe distance
311
+ if (touchEndX < touchStartX - threshold) {
312
+ // Swipe left - next slide
313
+ nextSlide();
314
+ } else if (touchEndX > touchStartX + threshold) {
315
+ // Swipe right - previous slide
316
+ currentSlide = (currentSlide - 1 + imageFiles.length) % imageFiles.length;
317
+ updateSliderPosition();
318
+ updateNavDots();
319
+ }
320
+ }
321
+
322
+ // Initialize the gallery
323
+ initGallery();
324
+ });
325
+ </script>
326
+ <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=vishnumeher/mem" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
327
+ </html>