Jah72 commited on
Commit
cb953ef
·
verified ·
1 Parent(s): eb1042a

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +347 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Weather
3
- emoji: 😻
4
- colorFrom: purple
5
- colorTo: indigo
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: weather
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: red
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,347 @@
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>WeatherSync Clock</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
9
+ <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
10
+ <style>
11
+ @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Poppins:wght@300;400;600&display=swap');
12
+
13
+ body {
14
+ font-family: 'Poppins', sans-serif;
15
+ background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
16
+ color: white;
17
+ height: 100vh;
18
+ overflow: hidden;
19
+ margin: 0;
20
+ transition: background 1s ease;
21
+ }
22
+
23
+ .clock-container {
24
+ backdrop-filter: blur(10px);
25
+ background: rgba(255, 255, 255, 0.1);
26
+ border-radius: 20px;
27
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
28
+ border: 1px solid rgba(255, 255, 255, 0.1);
29
+ }
30
+
31
+ .clock {
32
+ font-family: 'Orbitron', sans-serif;
33
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
34
+ }
35
+
36
+ .weather-icon {
37
+ font-size: 4rem;
38
+ filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
39
+ }
40
+
41
+ .particle {
42
+ position: absolute;
43
+ border-radius: 50%;
44
+ pointer-events: none;
45
+ z-index: -1;
46
+ }
47
+
48
+ .rain {
49
+ position: absolute;
50
+ width: 2px;
51
+ background: rgba(255, 255, 255, 0.6);
52
+ animation: rain linear infinite;
53
+ }
54
+
55
+ .snow {
56
+ position: absolute;
57
+ width: 6px;
58
+ height: 6px;
59
+ background: white;
60
+ border-radius: 50%;
61
+ filter: blur(1px);
62
+ animation: snow linear infinite;
63
+ }
64
+
65
+ @keyframes rain {
66
+ to {
67
+ transform: translateY(100vh);
68
+ }
69
+ }
70
+
71
+ @keyframes snow {
72
+ to {
73
+ transform: translateY(100vh) rotate(360deg);
74
+ }
75
+ }
76
+
77
+ .sun {
78
+ position: absolute;
79
+ width: 80px;
80
+ height: 80px;
81
+ background: radial-gradient(circle, #ffde00 30%, #ff8c00 100%);
82
+ border-radius: 50%;
83
+ box-shadow: 0 0 40px 15px rgba(255, 214, 0, 0.5);
84
+ z-index: -1;
85
+ }
86
+
87
+ .sun-ray {
88
+ position: absolute;
89
+ width: 100px;
90
+ height: 5px;
91
+ background: linear-gradient(90deg, rgba(255,214,0,0.5) 0%, rgba(255,214,0,0.8) 50%, rgba(255,214,0,0.5) 100%);
92
+ border-radius: 5px;
93
+ z-index: -2;
94
+ }
95
+
96
+ .cloud {
97
+ position: absolute;
98
+ z-index: -1;
99
+ }
100
+
101
+ .notification {
102
+ animation: pulse 2s infinite;
103
+ }
104
+
105
+ @keyframes pulse {
106
+ 0% { transform: scale(1); }
107
+ 50% { transform: scale(1.05); }
108
+ 100% { transform: scale(1); }
109
+ }
110
+ </style>
111
+ </head>
112
+ <body class="flex items-center justify-center">
113
+ <div class="clock-container p-8 w-11/12 max-w-4xl">
114
+ <div class="flex flex-col md:flex-row items-center justify-between gap-8">
115
+ <!-- Clock Section -->
116
+ <div class="flex-1 text-center">
117
+ <div class="clock text-6xl md:text-8xl font-bold mb-4"></div>
118
+ <div class="date text-2xl opacity-80"></div>
119
+ </div>
120
+
121
+ <!-- Weather Section -->
122
+ <div class="flex-1 text-center">
123
+ <div class="weather-icon mb-4">
124
+ <i class="fas fa-sun"></i>
125
+ </div>
126
+ <div class="temperature text-5xl font-bold mb-2">--°C</div>
127
+ <div class="weather-description text-xl opacity-80">Loading weather...</div>
128
+ <div class="location text-lg opacity-70 mt-2">Your Location</div>
129
+
130
+ <!-- Weather Details -->
131
+ <div class="grid grid-cols-2 gap-4 mt-6 text-left">
132
+ <div class="flex items-center">
133
+ <i class="fas fa-wind mr-2"></i>
134
+ <span class="wind-speed">-- km/h</span>
135
+ </div>
136
+ <div class="flex items-center">
137
+ <i class="fas fa-tint mr-2"></i>
138
+ <span class="humidity">--%</span>
139
+ </div>
140
+ <div class="flex items-center">
141
+ <i class="fas fa-eye mr-2"></i>
142
+ <span class="visibility">-- km</span>
143
+ </div>
144
+ <div class="flex items-center">
145
+ <i class="fas fa-cloud-rain mr-2"></i>
146
+ <span class="precipitation">-- mm</span>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </div>
151
+
152
+ <!-- Temperature Reminder -->
153
+ <div class="reminder-container mt-8 p-4 rounded-lg bg-white bg-opacity-10 hidden">
154
+ <div class="flex items-center justify-center gap-4">
155
+ <i class="fas fa-exclamation-circle text-2xl"></i>
156
+ <div class="reminder-text text-lg font-medium"></div>
157
+ </div>
158
+ </div>
159
+ </div>
160
+
161
+ <script>
162
+ // Clock Functionality
163
+ function updateClock() {
164
+ const now = moment();
165
+ const clockElement = document.querySelector('.clock');
166
+ const dateElement = document.querySelector('.date');
167
+
168
+ clockElement.textContent = now.format('HH:mm:ss');
169
+ dateElement.textContent = now.format('dddd, MMMM Do YYYY');
170
+
171
+ setTimeout(updateClock, 1000);
172
+ }
173
+
174
+ // Weather Functionality
175
+ async function fetchWeather() {
176
+ try {
177
+ // First get user's location
178
+ const position = await new Promise((resolve, reject) => {
179
+ navigator.geolocation.getCurrentPosition(resolve, reject);
180
+ });
181
+
182
+ const { latitude, longitude } = position.coords;
183
+
184
+ // Using OpenWeatherMap API (you'll need to get your own API key)
185
+ const apiKey = 'YOUR_OPENWEATHERMAP_API_KEY'; // Replace with your actual API key
186
+ const response = await fetch(
187
+ `https://api.openweathermap.org/data/2.5/weather?lat=${latitude}&lon=${longitude}&units=metric&appid=${apiKey}`
188
+ );
189
+
190
+ const data = await response.json();
191
+
192
+ updateWeatherUI(data);
193
+ createWeatherEffects(data.weather[0].main);
194
+ checkTemperatureReminders(data.main.temp);
195
+
196
+ } catch (error) {
197
+ console.error('Error fetching weather:', error);
198
+ // Fallback to static data if API fails
199
+ updateWeatherUI({
200
+ name: "Unknown Location",
201
+ main: { temp: 22, humidity: 65, pressure: 1012 },
202
+ wind: { speed: 12 },
203
+ weather: [{ main: "Clear", description: "clear sky", icon: "01d" }],
204
+ visibility: 10000,
205
+ rain: { '1h': 0 }
206
+ });
207
+ }
208
+ }
209
+
210
+ function updateWeatherUI(data) {
211
+ document.querySelector('.temperature').textContent = `${Math.round(data.main.temp)}°C`;
212
+ document.querySelector('.weather-description').textContent = data.weather[0].description;
213
+ document.querySelector('.location').textContent = data.name;
214
+ document.querySelector('.wind-speed').textContent = `${Math.round(data.wind.speed * 3.6)} km/h`;
215
+ document.querySelector('.humidity').textContent = `${data.main.humidity}%`;
216
+ document.querySelector('.visibility').textContent = `${data.visibility / 1000} km`;
217
+ document.querySelector('.precipitation').textContent = `${data.rain ? data.rain['1h'] || 0 : 0} mm`;
218
+
219
+ // Update weather icon
220
+ const weatherIcon = document.querySelector('.weather-icon i');
221
+ const weatherMain = data.weather[0].main.toLowerCase();
222
+
223
+ if (weatherMain.includes('thunderstorm')) {
224
+ weatherIcon.className = 'fas fa-bolt';
225
+ } else if (weatherMain.includes('drizzle') || weatherMain.includes('rain')) {
226
+ weatherIcon.className = 'fas fa-cloud-rain';
227
+ } else if (weatherMain.includes('snow')) {
228
+ weatherIcon.className = 'fas fa-snowflake';
229
+ } else if (weatherMain.includes('clear')) {
230
+ const isDay = data.weather[0].icon.includes('d');
231
+ weatherIcon.className = isDay ? 'fas fa-sun' : 'fas fa-moon';
232
+ } else if (weatherMain.includes('clouds')) {
233
+ weatherIcon.className = 'fas fa-cloud';
234
+ } else if (weatherMain.includes('mist') || weatherMain.includes('fog')) {
235
+ weatherIcon.className = 'fas fa-smog';
236
+ }
237
+ }
238
+
239
+ function createWeatherEffects(weatherCondition) {
240
+ // Clear previous effects
241
+ document.querySelectorAll('.particle, .rain, .snow, .sun, .sun-ray, .cloud').forEach(el => el.remove());
242
+
243
+ // Create new effects based on weather
244
+ if (weatherCondition === 'Rain') {
245
+ createRainEffect();
246
+ } else if (weatherCondition === 'Snow') {
247
+ createSnowEffect();
248
+ } else if (weatherCondition === 'Clear') {
249
+ createSunEffect();
250
+ } else if (weatherCondition === 'Clouds') {
251
+ createCloudEffect();
252
+ }
253
+ }
254
+
255
+ function createRainEffect() {
256
+ for (let i = 0; i < 100; i++) {
257
+ const rain = document.createElement('div');
258
+ rain.className = 'rain';
259
+ rain.style.left = `${Math.random() * 100}%`;
260
+ rain.style.top = `${Math.random() * 100}%`;
261
+ rain.style.height = `${10 + Math.random() * 20}px`;
262
+ rain.style.animationDuration = `${0.5 + Math.random() * 1}s`;
263
+ document.body.appendChild(rain);
264
+ }
265
+ }
266
+
267
+ function createSnowEffect() {
268
+ for (let i = 0; i < 50; i++) {
269
+ const snow = document.createElement('div');
270
+ snow.className = 'snow';
271
+ snow.style.left = `${Math.random() * 100}%`;
272
+ snow.style.top = `${Math.random() * 100}%`;
273
+ snow.style.width = `${4 + Math.random() * 4}px`;
274
+ snow.style.height = snow.style.width;
275
+ snow.style.opacity = 0.5 + Math.random() * 0.5;
276
+ snow.style.animationDuration = `${5 + Math.random() * 10}s`;
277
+ document.body.appendChild(snow);
278
+ }
279
+ }
280
+
281
+ function createSunEffect() {
282
+ const sun = document.createElement('div');
283
+ sun.className = 'sun';
284
+ sun.style.top = '20%';
285
+ sun.style.right = '20%';
286
+ document.body.appendChild(sun);
287
+
288
+ // Add sun rays
289
+ for (let i = 0; i < 12; i++) {
290
+ const ray = document.createElement('div');
291
+ ray.className = 'sun-ray';
292
+ ray.style.top = '20%';
293
+ ray.style.right = '20%';
294
+ ray.style.transform = `rotate(${i * 30}deg) translateX(60px)`;
295
+ ray.style.opacity = 0.7;
296
+ document.body.appendChild(ray);
297
+ }
298
+ }
299
+
300
+ function createCloudEffect() {
301
+ for (let i = 0; i < 3; i++) {
302
+ const cloud = document.createElement('div');
303
+ cloud.className = 'cloud';
304
+ cloud.innerHTML = '<i class="fas fa-cloud text-6xl opacity-50"></i>';
305
+ cloud.style.top = `${10 + Math.random() * 30}%`;
306
+ cloud.style.left = `${Math.random() * 100}%`;
307
+ cloud.style.fontSize = `${3 + Math.random() * 5}rem`;
308
+ document.body.appendChild(cloud);
309
+ }
310
+ }
311
+
312
+ function checkTemperatureReminders(temp) {
313
+ const reminderContainer = document.querySelector('.reminder-container');
314
+ const reminderText = document.querySelector('.reminder-text');
315
+
316
+ reminderContainer.classList.add('hidden');
317
+
318
+ if (temp < 0) {
319
+ reminderText.textContent = 'Extreme cold! Wear heavy winter clothing.';
320
+ reminderContainer.className = reminderContainer.className.replace('hidden', '') + ' notification bg-blue-500';
321
+ reminderContainer.classList.remove('hidden');
322
+ } else if (temp < 10) {
323
+ reminderText.textContent = 'Chilly weather! Wear a warm jacket.';
324
+ reminderContainer.className = reminderContainer.className.replace('hidden', '') + ' bg-blue-400';
325
+ reminderContainer.classList.remove('hidden');
326
+ } else if (temp > 30) {
327
+ reminderText.textContent = 'Hot weather! Stay hydrated and wear light clothing.';
328
+ reminderContainer.className = reminderContainer.className.replace('hidden', '') + ' notification bg-red-500';
329
+ reminderContainer.classList.remove('hidden');
330
+ } else if (temp > 25) {
331
+ reminderText.textContent = 'Warm weather! Stay hydrated.';
332
+ reminderContainer.className = reminderContainer.className.replace('hidden', '') + ' bg-orange-400';
333
+ reminderContainer.classList.remove('hidden');
334
+ }
335
+ }
336
+
337
+ // Initialize everything
338
+ document.addEventListener('DOMContentLoaded', () => {
339
+ updateClock();
340
+ fetchWeather();
341
+
342
+ // Update weather every 30 minutes
343
+ setInterval(fetchWeather, 30 * 60 * 1000);
344
+ });
345
+ </script>
346
+ <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=Jah72/weather" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
347
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Help me create a desktop - based clock that can be linked to the local real - time weather, and has weather special effects and temperature reminders.