Workpam commited on
Commit
3d8eaa0
·
verified ·
1 Parent(s): 0b8fa0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +125 -1
app.py CHANGED
@@ -158,7 +158,131 @@ def download_image(url, save_path):
158
  # Fail
159
  log_failure(url, "All methods failed")
160
  return None
161
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  def resize_with_padding(img, target_w, target_h, fill=(255,255,255)):
163
  img.thumbnail((target_w, target_h), Image.LANCZOS)
164
  bg = Image.new("RGB", (target_w, target_h), fill)
 
158
  # Fail
159
  log_failure(url, "All methods failed")
160
  return None
161
+ lamp_html = """
162
+ <style>
163
+ * {
164
+ margin: 0;
165
+ padding: 0;
166
+ box-sizing: border-box;
167
+ }
168
+ body {
169
+ background-color: #D8D2C2;
170
+ transition: background 0.4s ease;
171
+ }
172
+ body.night {
173
+ background: radial-gradient(#555, #111);
174
+ }
175
+ .lamp-fixed {
176
+ position: fixed;
177
+ top: 0;
178
+ right: 0;
179
+ width: 100px;
180
+ height: 100vh;
181
+ display: flex;
182
+ flex-direction: column;
183
+ align-items: center;
184
+ z-index: 9999;
185
+ pointer-events: none;
186
+ }
187
+ .mount {
188
+ width: 30px;
189
+ height: 5px;
190
+ background: #111;
191
+ border-radius: 6px;
192
+ pointer-events: none;
193
+ }
194
+ .wire {
195
+ width: 4px;
196
+ height: 120px;
197
+ background: #000;
198
+ margin: 0;
199
+ pointer-events: none;
200
+ }
201
+ .blub {
202
+ position: relative;
203
+ width: 47px;
204
+ height: 47px;
205
+ background: #444;
206
+ border-radius: 50%;
207
+ cursor: pointer;
208
+ margin-top: -1px;
209
+ transition: all 0.3s ease;
210
+ z-index: 2;
211
+ pointer-events: auto;
212
+ }
213
+ .blub.night {
214
+ background: #ffec99;
215
+ box-shadow: 0 0 28px #ffec99, 0 0 56px #ffec99,
216
+ 0 0 84px #ffec99, 0 0 168px #ffec99;
217
+ }
218
+ .blub.night::before {
219
+ background: #ffec99;
220
+ }
221
+ .blub.night::after {
222
+ content: "";
223
+ position: absolute;
224
+ top: 50%;
225
+ left: 50%;
226
+ transform: translate(-60%, -50%);
227
+ width: 78px;
228
+ height: 78px;
229
+ background: #ffec99;
230
+ border-radius: 100%;
231
+ filter: blur(26px);
232
+ z-index: -1;
233
+ }
234
+ .blub::before {
235
+ content: "";
236
+ position: absolute;
237
+ top: -30px;
238
+ left: 11px;
239
+ width: 25px;
240
+ height: 47px;
241
+ background: #444;
242
+ border-top: 19px solid #000;
243
+ border-radius: 8px;
244
+ transition: background 0.3s ease;
245
+ }
246
+ .blub span:nth-child(1) {
247
+ position: absolute;
248
+ top: -10px;
249
+ left: -2px;
250
+ width: 20px;
251
+ height: 18px;
252
+ background: transparent;
253
+ transform: rotate(343deg);
254
+ border-bottom-right-radius: 40px;
255
+ box-shadow: 12px 12px 0 5px #444;
256
+ transition: box-shadow 0.3s ease;
257
+ }
258
+ .blub.night span:nth-child(1) {
259
+ box-shadow: 12px 12px 0 5px #ffec99;
260
+ }
261
+ .blub span:nth-child(2) {
262
+ position: absolute;
263
+ top: -10px;
264
+ right: -2px;
265
+ width: 20px;
266
+ height: 18px;
267
+ background: transparent;
268
+ transform: rotate(18deg);
269
+ border-bottom-left-radius: 50px;
270
+ box-shadow: -12px 12px 0 5px #444;
271
+ transition: box-shadow 0.3s ease;
272
+ }
273
+ .blub.night span:nth-child(2) {
274
+ box-shadow: -12px 12px 0 5px #ffec99;
275
+ }
276
+ </style>
277
+ <div class="lamp-fixed">
278
+ <div class="mount"></div>
279
+ <div class="wire"></div>
280
+ <div class="blub" onclick="this.classList.toggle('night'); document.body.classList.toggle('night')">
281
+ <span></span>
282
+ <span></span>
283
+ </div>
284
+ </div>
285
+ """
286
  def resize_with_padding(img, target_w, target_h, fill=(255,255,255)):
287
  img.thumbnail((target_w, target_h), Image.LANCZOS)
288
  bg = Image.new("RGB", (target_w, target_h), fill)