Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +748 -480
templates/index.html
CHANGED
|
@@ -1,481 +1,749 @@
|
|
| 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>HuggingFace Uploader</title>
|
| 7 |
-
<style>
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
background
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
margin-bottom:
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
border-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
.file-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
text-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
background
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
}
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
}
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
}
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
}
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
</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>HuggingFace Uploader</title>
|
| 7 |
+
<style>
|
| 8 |
+
* {
|
| 9 |
+
margin: 0;
|
| 10 |
+
padding: 0;
|
| 11 |
+
box-sizing: border-box;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
body {
|
| 15 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
| 16 |
+
max-width: 900px;
|
| 17 |
+
margin: 0 auto;
|
| 18 |
+
padding: 20px;
|
| 19 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 20 |
+
min-height: 100vh;
|
| 21 |
+
position: relative;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
body::before {
|
| 25 |
+
content: '';
|
| 26 |
+
position: fixed;
|
| 27 |
+
top: 0;
|
| 28 |
+
left: 0;
|
| 29 |
+
right: 0;
|
| 30 |
+
bottom: 0;
|
| 31 |
+
background:
|
| 32 |
+
radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
|
| 33 |
+
radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%);
|
| 34 |
+
pointer-events: none;
|
| 35 |
+
z-index: -1;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.container {
|
| 39 |
+
background: rgba(255, 255, 255, 0.95);
|
| 40 |
+
backdrop-filter: blur(10px);
|
| 41 |
+
padding: 40px;
|
| 42 |
+
border-radius: 20px;
|
| 43 |
+
box-shadow:
|
| 44 |
+
0 20px 40px rgba(0, 0, 0, 0.1),
|
| 45 |
+
0 0 0 1px rgba(255, 255, 255, 0.2);
|
| 46 |
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
| 47 |
+
position: relative;
|
| 48 |
+
overflow: hidden;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.container::before {
|
| 52 |
+
content: '';
|
| 53 |
+
position: absolute;
|
| 54 |
+
top: 0;
|
| 55 |
+
left: 0;
|
| 56 |
+
right: 0;
|
| 57 |
+
height: 4px;
|
| 58 |
+
background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcf7f, #4ecdc4, #45b7d1);
|
| 59 |
+
border-radius: 20px 20px 0 0;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
h1 {
|
| 63 |
+
color: #2c3e50;
|
| 64 |
+
text-align: center;
|
| 65 |
+
margin-bottom: 40px;
|
| 66 |
+
font-size: 2.5em;
|
| 67 |
+
font-weight: 800;
|
| 68 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 69 |
+
-webkit-background-clip: text;
|
| 70 |
+
-webkit-text-fill-color: transparent;
|
| 71 |
+
background-clip: text;
|
| 72 |
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.form-group {
|
| 76 |
+
margin-bottom: 25px;
|
| 77 |
+
position: relative;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
label {
|
| 81 |
+
display: block;
|
| 82 |
+
margin-bottom: 8px;
|
| 83 |
+
font-weight: 600;
|
| 84 |
+
color: #34495e;
|
| 85 |
+
font-size: 14px;
|
| 86 |
+
text-transform: uppercase;
|
| 87 |
+
letter-spacing: 0.5px;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
input, select, textarea {
|
| 91 |
+
width: 100%;
|
| 92 |
+
padding: 16px 20px;
|
| 93 |
+
border: 2px solid #e0e6ed;
|
| 94 |
+
border-radius: 12px;
|
| 95 |
+
font-size: 16px;
|
| 96 |
+
transition: all 0.3s ease;
|
| 97 |
+
background: rgba(255, 255, 255, 0.9);
|
| 98 |
+
backdrop-filter: blur(5px);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
input:focus, select:focus, textarea:focus {
|
| 102 |
+
outline: none;
|
| 103 |
+
border-color: #667eea;
|
| 104 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
| 105 |
+
transform: translateY(-2px);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.file-input-container {
|
| 109 |
+
border: 3px dashed #e0e6ed;
|
| 110 |
+
border-radius: 16px;
|
| 111 |
+
padding: 40px 20px;
|
| 112 |
+
text-align: center;
|
| 113 |
+
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
| 114 |
+
transition: all 0.3s ease;
|
| 115 |
+
position: relative;
|
| 116 |
+
overflow: hidden;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.file-input-container::before {
|
| 120 |
+
content: '';
|
| 121 |
+
position: absolute;
|
| 122 |
+
top: 0;
|
| 123 |
+
left: -100%;
|
| 124 |
+
width: 100%;
|
| 125 |
+
height: 100%;
|
| 126 |
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
|
| 127 |
+
transition: left 0.6s ease;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.file-input-container:hover::before {
|
| 131 |
+
left: 100%;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
.file-input-container:hover {
|
| 135 |
+
border-color: #667eea;
|
| 136 |
+
background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
|
| 137 |
+
transform: translateY(-2px);
|
| 138 |
+
box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.file-input-container.drag-over {
|
| 142 |
+
border-color: #667eea;
|
| 143 |
+
background: linear-gradient(135deg, #e6f3ff 0%, #d1ecf1 100%);
|
| 144 |
+
transform: scale(1.02);
|
| 145 |
+
box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
#files {
|
| 149 |
+
display: none;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
.file-input-label {
|
| 153 |
+
display: inline-block;
|
| 154 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 155 |
+
color: white;
|
| 156 |
+
padding: 16px 32px;
|
| 157 |
+
border-radius: 12px;
|
| 158 |
+
cursor: pointer;
|
| 159 |
+
margin-bottom: 15px;
|
| 160 |
+
transition: all 0.3s ease;
|
| 161 |
+
font-weight: 600;
|
| 162 |
+
text-transform: uppercase;
|
| 163 |
+
letter-spacing: 0.5px;
|
| 164 |
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
|
| 165 |
+
position: relative;
|
| 166 |
+
overflow: hidden;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.file-input-label::before {
|
| 170 |
+
content: '';
|
| 171 |
+
position: absolute;
|
| 172 |
+
top: 0;
|
| 173 |
+
left: -100%;
|
| 174 |
+
width: 100%;
|
| 175 |
+
height: 100%;
|
| 176 |
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
| 177 |
+
transition: left 0.6s ease;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.file-input-label:hover::before {
|
| 181 |
+
left: 100%;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.file-input-label:hover {
|
| 185 |
+
transform: translateY(-2px);
|
| 186 |
+
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
.upload-modes {
|
| 190 |
+
display: grid;
|
| 191 |
+
grid-template-columns: repeat(3, 1fr);
|
| 192 |
+
gap: 15px;
|
| 193 |
+
margin-bottom: 25px;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.upload-mode {
|
| 197 |
+
padding: 20px 15px;
|
| 198 |
+
border: 2px solid #e0e6ed;
|
| 199 |
+
border-radius: 12px;
|
| 200 |
+
text-align: center;
|
| 201 |
+
cursor: pointer;
|
| 202 |
+
transition: all 0.3s ease;
|
| 203 |
+
font-weight: 600;
|
| 204 |
+
background: rgba(255, 255, 255, 0.9);
|
| 205 |
+
backdrop-filter: blur(5px);
|
| 206 |
+
position: relative;
|
| 207 |
+
overflow: hidden;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
.upload-mode::before {
|
| 211 |
+
content: '';
|
| 212 |
+
position: absolute;
|
| 213 |
+
top: 0;
|
| 214 |
+
left: 0;
|
| 215 |
+
right: 0;
|
| 216 |
+
bottom: 0;
|
| 217 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 218 |
+
opacity: 0;
|
| 219 |
+
transition: opacity 0.3s ease;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
.upload-mode span {
|
| 223 |
+
position: relative;
|
| 224 |
+
z-index: 1;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
.upload-mode.active {
|
| 228 |
+
border-color: #667eea;
|
| 229 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 230 |
+
color: white;
|
| 231 |
+
transform: translateY(-2px);
|
| 232 |
+
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.upload-mode:hover {
|
| 236 |
+
border-color: #667eea;
|
| 237 |
+
transform: translateY(-2px);
|
| 238 |
+
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.file-list {
|
| 242 |
+
margin-top: 20px;
|
| 243 |
+
padding: 20px;
|
| 244 |
+
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
| 245 |
+
border-radius: 12px;
|
| 246 |
+
max-height: 250px;
|
| 247 |
+
overflow-y: auto;
|
| 248 |
+
border: 1px solid rgba(0, 0, 0, 0.05);
|
| 249 |
+
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.file-item {
|
| 253 |
+
display: flex;
|
| 254 |
+
justify-content: space-between;
|
| 255 |
+
align-items: center;
|
| 256 |
+
padding: 12px 0;
|
| 257 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
| 258 |
+
transition: all 0.3s ease;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
.file-item:last-child {
|
| 262 |
+
border-bottom: none;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.file-item:hover {
|
| 266 |
+
background: rgba(102, 126, 234, 0.05);
|
| 267 |
+
border-radius: 8px;
|
| 268 |
+
padding: 12px 10px;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
.remove-file {
|
| 272 |
+
color: #e74c3c;
|
| 273 |
+
cursor: pointer;
|
| 274 |
+
font-weight: bold;
|
| 275 |
+
padding: 6px 10px;
|
| 276 |
+
border-radius: 6px;
|
| 277 |
+
transition: all 0.3s ease;
|
| 278 |
+
background: rgba(231, 76, 60, 0.1);
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
.remove-file:hover {
|
| 282 |
+
background: #e74c3c;
|
| 283 |
+
color: white;
|
| 284 |
+
transform: scale(1.1);
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
.btn {
|
| 288 |
+
background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
|
| 289 |
+
color: white;
|
| 290 |
+
padding: 18px 40px;
|
| 291 |
+
border: none;
|
| 292 |
+
border-radius: 12px;
|
| 293 |
+
font-size: 18px;
|
| 294 |
+
font-weight: 600;
|
| 295 |
+
cursor: pointer;
|
| 296 |
+
transition: all 0.3s ease;
|
| 297 |
+
width: 100%;
|
| 298 |
+
text-transform: uppercase;
|
| 299 |
+
letter-spacing: 0.5px;
|
| 300 |
+
box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
|
| 301 |
+
position: relative;
|
| 302 |
+
overflow: hidden;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
.btn::before {
|
| 306 |
+
content: '';
|
| 307 |
+
position: absolute;
|
| 308 |
+
top: 0;
|
| 309 |
+
left: -100%;
|
| 310 |
+
width: 100%;
|
| 311 |
+
height: 100%;
|
| 312 |
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
| 313 |
+
transition: left 0.6s ease;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.btn:hover::before {
|
| 317 |
+
left: 100%;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
.btn:hover {
|
| 321 |
+
transform: translateY(-2px);
|
| 322 |
+
box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
.btn:disabled {
|
| 326 |
+
background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
|
| 327 |
+
cursor: not-allowed;
|
| 328 |
+
transform: none;
|
| 329 |
+
box-shadow: none;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.progress-container {
|
| 333 |
+
margin-top: 30px;
|
| 334 |
+
display: none;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
.progress-bar {
|
| 338 |
+
width: 100%;
|
| 339 |
+
height: 12px;
|
| 340 |
+
background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
|
| 341 |
+
border-radius: 6px;
|
| 342 |
+
overflow: hidden;
|
| 343 |
+
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 344 |
+
position: relative;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
.progress-fill {
|
| 348 |
+
height: 100%;
|
| 349 |
+
background: linear-gradient(90deg, #00b894, #00a085, #fdcb6e, #e17055);
|
| 350 |
+
background-size: 200% 100%;
|
| 351 |
+
animation: progressShine 2s linear infinite;
|
| 352 |
+
transition: width 0.3s ease;
|
| 353 |
+
width: 0%;
|
| 354 |
+
border-radius: 6px;
|
| 355 |
+
box-shadow: 0 0 10px rgba(0, 184, 148, 0.5);
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
@keyframes progressShine {
|
| 359 |
+
0% { background-position: 200% 0; }
|
| 360 |
+
100% { background-position: -200% 0; }
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
.progress-text {
|
| 364 |
+
text-align: center;
|
| 365 |
+
margin-top: 15px;
|
| 366 |
+
font-weight: 600;
|
| 367 |
+
color: #2c3e50;
|
| 368 |
+
font-size: 16px;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
.error {
|
| 372 |
+
color: #e74c3c;
|
| 373 |
+
background: linear-gradient(135deg, #fdcbcb 0%, #fecaca 100%);
|
| 374 |
+
border: 1px solid #f5c6cb;
|
| 375 |
+
padding: 16px 20px;
|
| 376 |
+
border-radius: 12px;
|
| 377 |
+
margin-top: 20px;
|
| 378 |
+
box-shadow: 0 4px 15px rgba(231, 76, 60, 0.1);
|
| 379 |
+
border-left: 4px solid #e74c3c;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
.success {
|
| 383 |
+
color: #00b894;
|
| 384 |
+
background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
|
| 385 |
+
border: 1px solid #c3e6cb;
|
| 386 |
+
padding: 16px 20px;
|
| 387 |
+
border-radius: 12px;
|
| 388 |
+
margin-top: 20px;
|
| 389 |
+
box-shadow: 0 4px 15px rgba(0, 184, 148, 0.1);
|
| 390 |
+
border-left: 4px solid #00b894;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
.help-text {
|
| 394 |
+
font-size: 13px;
|
| 395 |
+
color: #7f8c8d;
|
| 396 |
+
margin-top: 8px;
|
| 397 |
+
font-style: italic;
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
.folder-instructions {
|
| 401 |
+
background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
|
| 402 |
+
border: 1px solid #ffeaa7;
|
| 403 |
+
padding: 16px 20px;
|
| 404 |
+
border-radius: 12px;
|
| 405 |
+
margin-top: 20px;
|
| 406 |
+
font-size: 14px;
|
| 407 |
+
box-shadow: 0 4px 15px rgba(255, 234, 167, 0.2);
|
| 408 |
+
border-left: 4px solid #fdcb6e;
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
#uploadInstructions {
|
| 412 |
+
font-size: 16px;
|
| 413 |
+
color: #2c3e50;
|
| 414 |
+
line-height: 1.6;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
#uploadInstructions p {
|
| 418 |
+
margin-bottom: 10px;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
#uploadInstructions strong {
|
| 422 |
+
color: #667eea;
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
/* Responsive design */
|
| 426 |
+
@media (max-width: 768px) {
|
| 427 |
+
.container {
|
| 428 |
+
padding: 20px;
|
| 429 |
+
margin: 10px;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
.upload-modes {
|
| 433 |
+
grid-template-columns: 1fr;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
h1 {
|
| 437 |
+
font-size: 2em;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
.file-input-container {
|
| 441 |
+
padding: 30px 15px;
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
/* Smooth scrollbar for file list */
|
| 446 |
+
.file-list::-webkit-scrollbar {
|
| 447 |
+
width: 6px;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
.file-list::-webkit-scrollbar-track {
|
| 451 |
+
background: rgba(0, 0, 0, 0.1);
|
| 452 |
+
border-radius: 3px;
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
.file-list::-webkit-scrollbar-thumb {
|
| 456 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 457 |
+
border-radius: 3px;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
.file-list::-webkit-scrollbar-thumb:hover {
|
| 461 |
+
background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
|
| 462 |
+
}
|
| 463 |
+
</style>
|
| 464 |
+
</head>
|
| 465 |
+
<body>
|
| 466 |
+
<div class="container">
|
| 467 |
+
<h1>π€ HuggingFace Uploader</h1>
|
| 468 |
+
|
| 469 |
+
<form id="uploadForm" enctype="multipart/form-data">
|
| 470 |
+
<div class="form-group">
|
| 471 |
+
<label for="hf_token">HuggingFace Token:</label>
|
| 472 |
+
<input type="password" id="hf_token" name="hf_token" required
|
| 473 |
+
placeholder="hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
|
| 474 |
+
<div class="help-text">Get your token from: https://huggingface.co/settings/tokens</div>
|
| 475 |
+
</div>
|
| 476 |
+
|
| 477 |
+
<div class="form-group">
|
| 478 |
+
<label for="repo_id">Repository ID:</label>
|
| 479 |
+
<input type="text" id="repo_id" name="repo_id" required
|
| 480 |
+
placeholder="your-username/repository-name">
|
| 481 |
+
<div class="help-text">Format: username/repository-name</div>
|
| 482 |
+
</div>
|
| 483 |
+
|
| 484 |
+
<div class="form-group">
|
| 485 |
+
<label for="repo_type">Repository Type:</label>
|
| 486 |
+
<select id="repo_type" name="repo_type">
|
| 487 |
+
<option value="space">Space</option>
|
| 488 |
+
<option value="model">Model</option>
|
| 489 |
+
<option value="dataset">Dataset</option>
|
| 490 |
+
</select>
|
| 491 |
+
</div>
|
| 492 |
+
|
| 493 |
+
<div class="form-group">
|
| 494 |
+
<label for="commit_message">Commit Message:</label>
|
| 495 |
+
<textarea id="commit_message" name="commit_message" rows="2"
|
| 496 |
+
placeholder="Upload via Flask App">Upload via Flask App</textarea>
|
| 497 |
+
</div>
|
| 498 |
+
|
| 499 |
+
<div class="form-group">
|
| 500 |
+
<label>Upload Type:</label>
|
| 501 |
+
<div class="upload-modes">
|
| 502 |
+
<div class="upload-mode active" data-mode="folder">
|
| 503 |
+
<span>π Folder</span>
|
| 504 |
+
</div>
|
| 505 |
+
<div class="upload-mode" data-mode="files">
|
| 506 |
+
<span>π Files</span>
|
| 507 |
+
</div>
|
| 508 |
+
<div class="upload-mode" data-mode="zip">
|
| 509 |
+
<span>π¦ ZIP Archive</span>
|
| 510 |
+
</div>
|
| 511 |
+
</div>
|
| 512 |
+
</div>
|
| 513 |
+
|
| 514 |
+
<div class="form-group">
|
| 515 |
+
<label>Select Files:</label>
|
| 516 |
+
<div class="file-input-container" id="fileInputContainer">
|
| 517 |
+
<label for="files" class="file-input-label">
|
| 518 |
+
π Choose Files or Drag & Drop
|
| 519 |
+
</label>
|
| 520 |
+
<input type="file" id="files" name="files" multiple webkitdirectory style="display: none;">
|
| 521 |
+
<div id="uploadInstructions">
|
| 522 |
+
<p>π <strong>Folder Mode:</strong> Click "Choose Files" and select a folder to upload all its contents</p>
|
| 523 |
+
<p>All files and subdirectories will be uploaded maintaining the folder structure</p>
|
| 524 |
+
</div>
|
| 525 |
+
</div>
|
| 526 |
+
<div class="folder-instructions">
|
| 527 |
+
<strong>Note:</strong> When uploading folders, the browser will ask you to select a folder.
|
| 528 |
+
All files in the selected folder (including subfolders) will be uploaded to your HuggingFace repository with the same directory structure.
|
| 529 |
+
</div>
|
| 530 |
+
<div id="fileList" class="file-list" style="display: none;"></div>
|
| 531 |
+
</div>
|
| 532 |
+
|
| 533 |
+
<button type="submit" class="btn" id="uploadBtn">π Upload to HuggingFace</button>
|
| 534 |
+
</form>
|
| 535 |
+
|
| 536 |
+
<div class="progress-container" id="progressContainer">
|
| 537 |
+
<div class="progress-bar">
|
| 538 |
+
<div class="progress-fill" id="progressFill"></div>
|
| 539 |
+
</div>
|
| 540 |
+
<div class="progress-text" id="progressText">Starting upload...</div>
|
| 541 |
+
</div>
|
| 542 |
+
|
| 543 |
+
<div id="message"></div>
|
| 544 |
+
</div>
|
| 545 |
+
|
| 546 |
+
<script>
|
| 547 |
+
let selectedFiles = [];
|
| 548 |
+
let currentMode = 'folder';
|
| 549 |
+
|
| 550 |
+
// Upload mode switching
|
| 551 |
+
document.querySelectorAll('.upload-mode').forEach(mode => {
|
| 552 |
+
mode.addEventListener('click', function() {
|
| 553 |
+
document.querySelectorAll('.upload-mode').forEach(m => m.classList.remove('active'));
|
| 554 |
+
this.classList.add('active');
|
| 555 |
+
currentMode = this.dataset.mode;
|
| 556 |
+
|
| 557 |
+
const fileInput = document.getElementById('files');
|
| 558 |
+
const instructions = document.getElementById('uploadInstructions');
|
| 559 |
+
|
| 560 |
+
if (currentMode === 'zip') {
|
| 561 |
+
fileInput.removeAttribute('webkitdirectory');
|
| 562 |
+
fileInput.removeAttribute('multiple');
|
| 563 |
+
fileInput.setAttribute('accept', '.zip');
|
| 564 |
+
instructions.innerHTML = '<p>π¦ Select a ZIP file to upload</p>';
|
| 565 |
+
} else if (currentMode === 'folder') {
|
| 566 |
+
fileInput.setAttribute('webkitdirectory', '');
|
| 567 |
+
fileInput.setAttribute('multiple', '');
|
| 568 |
+
fileInput.removeAttribute('accept');
|
| 569 |
+
instructions.innerHTML = `
|
| 570 |
+
<p>π <strong>Folder Mode:</strong> Click "Choose Files" and select a folder to upload all its contents</p>
|
| 571 |
+
<p>All files and subdirectories will be uploaded maintaining the folder structure</p>
|
| 572 |
+
`;
|
| 573 |
+
} else {
|
| 574 |
+
fileInput.removeAttribute('webkitdirectory');
|
| 575 |
+
fileInput.setAttribute('multiple', '');
|
| 576 |
+
fileInput.removeAttribute('accept');
|
| 577 |
+
instructions.innerHTML = `
|
| 578 |
+
<p>π <strong>Files Mode:</strong> Select one or more individual files</p>
|
| 579 |
+
<p>Files will be uploaded to the root of your repository</p>
|
| 580 |
+
`;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
// Clear previous selections
|
| 584 |
+
selectedFiles = [];
|
| 585 |
+
updateFileList();
|
| 586 |
+
});
|
| 587 |
+
});
|
| 588 |
+
|
| 589 |
+
// File input handling
|
| 590 |
+
const fileInput = document.getElementById('files');
|
| 591 |
+
const fileInputContainer = document.getElementById('fileInputContainer');
|
| 592 |
+
const fileList = document.getElementById('fileList');
|
| 593 |
+
|
| 594 |
+
fileInput.addEventListener('change', function(e) {
|
| 595 |
+
selectedFiles = Array.from(e.target.files);
|
| 596 |
+
updateFileList();
|
| 597 |
+
});
|
| 598 |
+
|
| 599 |
+
// Drag and drop handling
|
| 600 |
+
fileInputContainer.addEventListener('dragover', function(e) {
|
| 601 |
+
e.preventDefault();
|
| 602 |
+
fileInputContainer.classList.add('drag-over');
|
| 603 |
+
});
|
| 604 |
+
|
| 605 |
+
fileInputContainer.addEventListener('dragleave', function(e) {
|
| 606 |
+
e.preventDefault();
|
| 607 |
+
fileInputContainer.classList.remove('drag-over');
|
| 608 |
+
});
|
| 609 |
+
|
| 610 |
+
fileInputContainer.addEventListener('drop', function(e) {
|
| 611 |
+
e.preventDefault();
|
| 612 |
+
fileInputContainer.classList.remove('drag-over');
|
| 613 |
+
|
| 614 |
+
const items = Array.from(e.dataTransfer.items);
|
| 615 |
+
selectedFiles = [];
|
| 616 |
+
|
| 617 |
+
items.forEach(item => {
|
| 618 |
+
if (item.kind === 'file') {
|
| 619 |
+
selectedFiles.push(item.getAsFile());
|
| 620 |
+
}
|
| 621 |
+
});
|
| 622 |
+
|
| 623 |
+
updateFileList();
|
| 624 |
+
});
|
| 625 |
+
|
| 626 |
+
function updateFileList() {
|
| 627 |
+
if (selectedFiles.length === 0) {
|
| 628 |
+
fileList.style.display = 'none';
|
| 629 |
+
return;
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
fileList.style.display = 'block';
|
| 633 |
+
fileList.innerHTML = '';
|
| 634 |
+
|
| 635 |
+
selectedFiles.forEach((file, index) => {
|
| 636 |
+
const fileItem = document.createElement('div');
|
| 637 |
+
fileItem.className = 'file-item';
|
| 638 |
+
const displayName = file.webkitRelativePath || file.name;
|
| 639 |
+
fileItem.innerHTML = `
|
| 640 |
+
<span>π ${displayName} (${formatFileSize(file.size)})</span>
|
| 641 |
+
<span class="remove-file" onclick="removeFile(${index})">β</span>
|
| 642 |
+
`;
|
| 643 |
+
fileList.appendChild(fileItem);
|
| 644 |
+
});
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
function removeFile(index) {
|
| 648 |
+
selectedFiles.splice(index, 1);
|
| 649 |
+
updateFileList();
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
function formatFileSize(bytes) {
|
| 653 |
+
if (bytes === 0) return '0 Bytes';
|
| 654 |
+
const k = 1024;
|
| 655 |
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
| 656 |
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
| 657 |
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
// Form submission
|
| 661 |
+
document.getElementById('uploadForm').addEventListener('submit', function(e) {
|
| 662 |
+
e.preventDefault();
|
| 663 |
+
|
| 664 |
+
if (selectedFiles.length === 0) {
|
| 665 |
+
showMessage('Please select files to upload', 'error');
|
| 666 |
+
return;
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
const formData = new FormData();
|
| 670 |
+
formData.append('hf_token', document.getElementById('hf_token').value);
|
| 671 |
+
formData.append('repo_id', document.getElementById('repo_id').value);
|
| 672 |
+
formData.append('repo_type', document.getElementById('repo_type').value);
|
| 673 |
+
formData.append('commit_message', document.getElementById('commit_message').value);
|
| 674 |
+
|
| 675 |
+
// Add files to form data
|
| 676 |
+
selectedFiles.forEach(file => {
|
| 677 |
+
formData.append('files', file);
|
| 678 |
+
});
|
| 679 |
+
|
| 680 |
+
// Show progress
|
| 681 |
+
document.getElementById('progressContainer').style.display = 'block';
|
| 682 |
+
document.getElementById('uploadBtn').disabled = true;
|
| 683 |
+
document.getElementById('uploadBtn').textContent = 'Uploading...';
|
| 684 |
+
|
| 685 |
+
fetch('/upload', {
|
| 686 |
+
method: 'POST',
|
| 687 |
+
body: formData
|
| 688 |
+
})
|
| 689 |
+
.then(response => response.json())
|
| 690 |
+
.then(data => {
|
| 691 |
+
if (data.success) {
|
| 692 |
+
showMessage(data.message, 'success');
|
| 693 |
+
checkProgress(data.upload_id);
|
| 694 |
+
} else {
|
| 695 |
+
showMessage(data.error || 'Upload failed', 'error');
|
| 696 |
+
resetForm();
|
| 697 |
+
}
|
| 698 |
+
})
|
| 699 |
+
.catch(error => {
|
| 700 |
+
showMessage('Error: ' + error.message, 'error');
|
| 701 |
+
resetForm();
|
| 702 |
+
});
|
| 703 |
+
});
|
| 704 |
+
|
| 705 |
+
function checkProgress(uploadId) {
|
| 706 |
+
const progressFill = document.getElementById('progressFill');
|
| 707 |
+
const progressText = document.getElementById('progressText');
|
| 708 |
+
|
| 709 |
+
const interval = setInterval(() => {
|
| 710 |
+
fetch(`/progress/${uploadId}`)
|
| 711 |
+
.then(response => response.json())
|
| 712 |
+
.then(data => {
|
| 713 |
+
progressFill.style.width = data.progress + '%';
|
| 714 |
+
progressText.textContent = data.status;
|
| 715 |
+
|
| 716 |
+
if (data.completed || data.progress === 100) {
|
| 717 |
+
clearInterval(interval);
|
| 718 |
+
if (data.status.includes('Error')) {
|
| 719 |
+
showMessage(data.status, 'error');
|
| 720 |
+
} else {
|
| 721 |
+
showMessage('Upload completed successfully! π', 'success');
|
| 722 |
+
}
|
| 723 |
+
resetForm();
|
| 724 |
+
}
|
| 725 |
+
})
|
| 726 |
+
.catch(error => {
|
| 727 |
+
clearInterval(interval);
|
| 728 |
+
showMessage('Error checking progress: ' + error.message, 'error');
|
| 729 |
+
resetForm();
|
| 730 |
+
});
|
| 731 |
+
}, 2000);
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
function showMessage(message, type) {
|
| 735 |
+
const messageDiv = document.getElementById('message');
|
| 736 |
+
messageDiv.className = type;
|
| 737 |
+
messageDiv.textContent = message;
|
| 738 |
+
messageDiv.style.display = 'block';
|
| 739 |
+
}
|
| 740 |
+
|
| 741 |
+
function resetForm() {
|
| 742 |
+
document.getElementById('uploadBtn').disabled = false;
|
| 743 |
+
document.getElementById('uploadBtn').textContent = 'π Upload to HuggingFace';
|
| 744 |
+
document.getElementById('progressContainer').style.display = 'none';
|
| 745 |
+
document.getElementById('progressFill').style.width = '0%';
|
| 746 |
+
}
|
| 747 |
+
</script>
|
| 748 |
+
</body>
|
| 749 |
</html>
|