Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- index.html +1169 -498
index.html
CHANGED
|
@@ -1,498 +1,1169 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 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 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 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 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 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 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
</
|
| 497 |
-
|
| 498 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
| 6 |
+
<title>Music Generation Tool</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--primary: #2dd4bf;
|
| 12 |
+
--primary-dark: #1da896;
|
| 13 |
+
--secondary: #f8fafc;
|
| 14 |
+
--accent: #fbbf24;
|
| 15 |
+
--text: #1e293b;
|
| 16 |
+
--text-light: #64748b;
|
| 17 |
+
--border: #e2e8f0;
|
| 18 |
+
--error: #ef4444;
|
| 19 |
+
--success: #22c55e;
|
| 20 |
+
--warning: #f59e0b;
|
| 21 |
+
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 22 |
+
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
* {
|
| 26 |
+
margin: 0;
|
| 27 |
+
padding: 0;
|
| 28 |
+
box-sizing: border-box;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
body {
|
| 32 |
+
font-family: 'Inter', sans-serif;
|
| 33 |
+
background-color: #f1f5f9;
|
| 34 |
+
color: var(--text);
|
| 35 |
+
line-height: 1.6;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.container {
|
| 39 |
+
max-width: 1200px;
|
| 40 |
+
margin: 0 auto;
|
| 41 |
+
padding: 20px;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
header {
|
| 45 |
+
background-color: white;
|
| 46 |
+
padding: 15px 0;
|
| 47 |
+
box-shadow: var(--shadow);
|
| 48 |
+
margin-bottom: 20px;
|
| 49 |
+
border-radius: 12px;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.header-content {
|
| 53 |
+
display: flex;
|
| 54 |
+
justify-content: space-between;
|
| 55 |
+
align-items: center;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.logo {
|
| 59 |
+
font-size: 1.5rem;
|
| 60 |
+
font-weight: 700;
|
| 61 |
+
color: var(--primary);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.built-with {
|
| 65 |
+
font-size: 0.875rem;
|
| 66 |
+
color: var(--text-light);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.built-with a {
|
| 70 |
+
color: var(--primary);
|
| 71 |
+
text-decoration: none;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.main-grid {
|
| 75 |
+
display: grid;
|
| 76 |
+
grid-template-columns: 1fr 1fr;
|
| 77 |
+
gap: 20px;
|
| 78 |
+
margin-bottom: 20px;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.card {
|
| 82 |
+
background-color: white;
|
| 83 |
+
border-radius: 12px;
|
| 84 |
+
padding: 20px;
|
| 85 |
+
box-shadow: var(--shadow);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
h2 {
|
| 89 |
+
font-size: 1.25rem;
|
| 90 |
+
font-weight: 600;
|
| 91 |
+
margin-bottom: 15px;
|
| 92 |
+
color: var(--primary);
|
| 93 |
+
border-bottom: 2px solid var(--primary);
|
| 94 |
+
padding-bottom: 10px;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.form-group {
|
| 98 |
+
margin-bottom: 15px;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
label {
|
| 102 |
+
display: block;
|
| 103 |
+
margin-bottom: 5px;
|
| 104 |
+
font-weight: 500;
|
| 105 |
+
color: var(--text);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
input[type="text"],
|
| 109 |
+
input[type="email"],
|
| 110 |
+
input[type="password"],
|
| 111 |
+
textarea,
|
| 112 |
+
select {
|
| 113 |
+
width: 100%;
|
| 114 |
+
padding: 10px;
|
| 115 |
+
border: 1px solid var(--border);
|
| 116 |
+
border-radius: 8px;
|
| 117 |
+
font-family: inherit;
|
| 118 |
+
font-size: 0.875rem;
|
| 119 |
+
transition: border-color 0.2s;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
input:focus,
|
| 123 |
+
textarea:focus,
|
| 124 |
+
select:focus {
|
| 125 |
+
outline: none;
|
| 126 |
+
border-color: var(--primary);
|
| 127 |
+
box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
textarea {
|
| 131 |
+
min-height: 100px;
|
| 132 |
+
resize: vertical;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.btn {
|
| 136 |
+
padding: 10px 15px;
|
| 137 |
+
border: none;
|
| 138 |
+
border-radius: 8px;
|
| 139 |
+
font-weight: 500;
|
| 140 |
+
cursor: pointer;
|
| 141 |
+
transition: all 0.2s;
|
| 142 |
+
font-size: 0.875rem;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
.btn-primary {
|
| 146 |
+
background-color: var(--primary);
|
| 147 |
+
color: white;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.btn-primary:hover {
|
| 151 |
+
background-color: var(--primary-dark);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.btn-secondary {
|
| 155 |
+
background-color: var(--secondary);
|
| 156 |
+
color: var(--text);
|
| 157 |
+
border: 1px solid var(--border);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.btn-secondary:hover {
|
| 161 |
+
background-color: #e2e8f0;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.btn-danger {
|
| 165 |
+
background-color: var(--error);
|
| 166 |
+
color: white;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.btn-danger:hover {
|
| 170 |
+
background-color: #dc2626;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
.btn-group {
|
| 174 |
+
display: flex;
|
| 175 |
+
gap: 10px;
|
| 176 |
+
margin-bottom: 15px;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
.output-area {
|
| 180 |
+
background-color: #f8fafc;
|
| 181 |
+
border: 1px solid var(--border);
|
| 182 |
+
border-radius: 8px;
|
| 183 |
+
padding: 15px;
|
| 184 |
+
min-height: 100px;
|
| 185 |
+
font-family: 'Courier New', monospace;
|
| 186 |
+
font-size: 0.875rem;
|
| 187 |
+
white-space: pre-wrap;
|
| 188 |
+
word-wrap: break-word;
|
| 189 |
+
margin-bottom: 15px;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.status-message {
|
| 193 |
+
padding: 10px;
|
| 194 |
+
border-radius: 8px;
|
| 195 |
+
margin-bottom: 15px;
|
| 196 |
+
font-size: 0.875rem;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
.status-success {
|
| 200 |
+
background-color: rgba(34, 197, 94, 0.1);
|
| 201 |
+
color: var(--success);
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
.status-error {
|
| 205 |
+
background-color: rgba(239, 68, 68, 0.1);
|
| 206 |
+
color: var(--error);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
.status-warning {
|
| 210 |
+
background-color: rgba(245, 158, 11, 0.1);
|
| 211 |
+
color: var(--warning);
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.checkbox-group {
|
| 215 |
+
display: flex;
|
| 216 |
+
align-items: center;
|
| 217 |
+
gap: 10px;
|
| 218 |
+
margin-bottom: 10px;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.checkbox-group input[type="checkbox"] {
|
| 222 |
+
width: auto;
|
| 223 |
+
accent-color: var(--primary);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
.file-upload {
|
| 227 |
+
border: 2px dashed var(--border);
|
| 228 |
+
border-radius: 8px;
|
| 229 |
+
padding: 20px;
|
| 230 |
+
text-align: center;
|
| 231 |
+
cursor: pointer;
|
| 232 |
+
transition: all 0.2s;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.file-upload:hover {
|
| 236 |
+
border-color: var(--primary);
|
| 237 |
+
background-color: rgba(45, 212, 191, 0.05);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
.file-upload input[type="file"] {
|
| 241 |
+
display: none;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.file-info {
|
| 245 |
+
display: flex;
|
| 246 |
+
align-items: center;
|
| 247 |
+
gap: 10px;
|
| 248 |
+
margin-top: 10px;
|
| 249 |
+
padding: 10px;
|
| 250 |
+
background-color: #f8fafc;
|
| 251 |
+
border-radius: 8px;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
.thumb-container {
|
| 255 |
+
position: relative;
|
| 256 |
+
margin-bottom: 10px;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.thumb {
|
| 260 |
+
width: 100%;
|
| 261 |
+
border-radius: 8px;
|
| 262 |
+
box-shadow: var(--shadow);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.miniBtn {
|
| 266 |
+
position: absolute;
|
| 267 |
+
bottom: 10px;
|
| 268 |
+
right: 10px;
|
| 269 |
+
padding: 5px 10px;
|
| 270 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 271 |
+
color: white;
|
| 272 |
+
border: none;
|
| 273 |
+
border-radius: 4px;
|
| 274 |
+
font-size: 0.75rem;
|
| 275 |
+
cursor: pointer;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
.processing-overlay {
|
| 279 |
+
position: fixed;
|
| 280 |
+
top: 0;
|
| 281 |
+
left: 0;
|
| 282 |
+
width: 100%;
|
| 283 |
+
height: 100%;
|
| 284 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 285 |
+
display: none;
|
| 286 |
+
justify-content: center;
|
| 287 |
+
align-items: center;
|
| 288 |
+
z-index: 1000;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
.processing-content {
|
| 292 |
+
background-color: white;
|
| 293 |
+
padding: 30px;
|
| 294 |
+
border-radius: 12px;
|
| 295 |
+
text-align: center;
|
| 296 |
+
max-width: 400px;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
.spinner {
|
| 300 |
+
border: 4px solid rgba(0, 0, 0, 0.1);
|
| 301 |
+
border-radius: 50%;
|
| 302 |
+
border-top: 4px solid var(--primary);
|
| 303 |
+
width: 40px;
|
| 304 |
+
height: 40px;
|
| 305 |
+
animation: spin 1s linear infinite;
|
| 306 |
+
margin: 0 auto 15px;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
@keyframes spin {
|
| 310 |
+
0% { transform: rotate(0deg); }
|
| 311 |
+
100% { transform: rotate(360deg); }
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
@media (max-width: 768px) {
|
| 315 |
+
.main-grid {
|
| 316 |
+
grid-template-columns: 1fr;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
.header-content {
|
| 320 |
+
flex-direction: column;
|
| 321 |
+
gap: 10px;
|
| 322 |
+
}
|
| 323 |
+
}
|
| 324 |
+
</style>
|
| 325 |
+
</head>
|
| 326 |
+
<body>
|
| 327 |
+
<header>
|
| 328 |
+
<div class="container">
|
| 329 |
+
<div class="header-content">
|
| 330 |
+
<div class="logo">Music Generation Tool</div>
|
| 331 |
+
<div class="built-with">
|
| 332 |
+
Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a>
|
| 333 |
+
</div>
|
| 334 |
+
</div>
|
| 335 |
+
</div>
|
| 336 |
+
</header>
|
| 337 |
+
|
| 338 |
+
<div class="container">
|
| 339 |
+
<div class="main-grid">
|
| 340 |
+
<div class="card">
|
| 341 |
+
<h2>API Configuration</h2>
|
| 342 |
+
<div class="form-group">
|
| 343 |
+
<label for="apiKey">OpenAI API Key</label>
|
| 344 |
+
<input type="password" id="apiKey" placeholder="Enter your OpenAI API key">
|
| 345 |
+
</div>
|
| 346 |
+
<div class="btn-group">
|
| 347 |
+
<button class="btn btn-primary" id="saveKeyBtn">Save Key</button>
|
| 348 |
+
<button class="btn btn-secondary" id="testKeyBtn">Test Key</button>
|
| 349 |
+
</div>
|
| 350 |
+
<div id="apiStatus" class="status-message" style="display: none;"></div>
|
| 351 |
+
|
| 352 |
+
<h2 style="margin-top: 25px;">Server Controls</h2>
|
| 353 |
+
<div class="btn-group">
|
| 354 |
+
<button class="btn btn-secondary" id="checkHealthBtn">Check Server Health</button>
|
| 355 |
+
<button class="btn btn-secondary" id="runDiagnosticsBtn">Run Diagnostics</button>
|
| 356 |
+
</div>
|
| 357 |
+
<div id="healthStatus" class="status-message" style="display: none;"></div>
|
| 358 |
+
<div id="diagOut" class="output-area" style="display: none;"></div>
|
| 359 |
+
</div>
|
| 360 |
+
|
| 361 |
+
<div class="card">
|
| 362 |
+
<h2>Form Controls</h2>
|
| 363 |
+
<div class="btn-group">
|
| 364 |
+
<button class="btn btn-secondary" id="randomizeBtn">Randomize Form</button>
|
| 365 |
+
<button class="btn btn-secondary" id="resetFormBtn">Reset Form</button>
|
| 366 |
+
</div>
|
| 367 |
+
<div class="btn-group">
|
| 368 |
+
<button class="btn btn-secondary" id="saveDraftBtn">Save Draft</button>
|
| 369 |
+
<button class="btn btn-secondary" id="loadDraftBtn">Load Draft</button>
|
| 370 |
+
</div>
|
| 371 |
+
<div id="warningsDisplay" class="status-message" style="display: none;"></div>
|
| 372 |
+
</div>
|
| 373 |
+
</div>
|
| 374 |
+
|
| 375 |
+
<div class="card">
|
| 376 |
+
<h2>Main Form</h2>
|
| 377 |
+
<div class="form-group">
|
| 378 |
+
<label for="songTitle">Song Title</label>
|
| 379 |
+
<input type="text" id="songTitle" placeholder="Enter song title">
|
| 380 |
+
</div>
|
| 381 |
+
|
| 382 |
+
<div class="form-group">
|
| 383 |
+
<label for="occasion">Occasion</label>
|
| 384 |
+
<input type="text" id="occasion" placeholder="e.g., Birthday, Anniversary">
|
| 385 |
+
</div>
|
| 386 |
+
|
| 387 |
+
<div class="form-group">
|
| 388 |
+
<label for="buyerName">Buyer Name</label>
|
| 389 |
+
<input type="text" id="buyerName" placeholder="Enter buyer name">
|
| 390 |
+
</div>
|
| 391 |
+
|
| 392 |
+
<div class="form-group">
|
| 393 |
+
<label for="recipientName">Recipient Name</label>
|
| 394 |
+
<input type="text" id="recipientName" placeholder="Enter recipient name">
|
| 395 |
+
</div>
|
| 396 |
+
|
| 397 |
+
<div class="form-group">
|
| 398 |
+
<label for="relationship">Relationship</label>
|
| 399 |
+
<input type="text" id="relationship" placeholder="e.g., Mother, Friend">
|
| 400 |
+
</div>
|
| 401 |
+
|
| 402 |
+
<div class="form-group">
|
| 403 |
+
<label for="tone">Tone/Vibe</label>
|
| 404 |
+
<input type="text" id="tone" placeholder="e.g., Happy, Romantic">
|
| 405 |
+
</div>
|
| 406 |
+
|
| 407 |
+
<div class="form-group">
|
| 408 |
+
<label for="mainGenre">Main Genre</label>
|
| 409 |
+
<input type="text" id="mainGenre" placeholder="e.g., Pop, Rock">
|
| 410 |
+
</div>
|
| 411 |
+
|
| 412 |
+
<div class="form-group">
|
| 413 |
+
<label for="secondaryGenres">Secondary Genres</label>
|
| 414 |
+
<input type="text" id="secondaryGenres" placeholder="e.g., Jazz, Electronic">
|
| 415 |
+
</div>
|
| 416 |
+
|
| 417 |
+
<div class="form-group">
|
| 418 |
+
<label for="tempo">Tempo/Energy</label>
|
| 419 |
+
<input type="text" id="tempo" placeholder="e.g., Fast, Slow">
|
| 420 |
+
</div>
|
| 421 |
+
|
| 422 |
+
<div class="form-group">
|
| 423 |
+
<label for="vocalStyle">Vocal Style</label>
|
| 424 |
+
<input type="text" id="vocalStyle" placeholder="e.g., Male, Female, Choir">
|
| 425 |
+
</div>
|
| 426 |
+
|
| 427 |
+
<div class="form-group">
|
| 428 |
+
<label for="instrumentationNotes">Instrumentation Notes</label>
|
| 429 |
+
<textarea id="instrumentationNotes" placeholder="Any specific instruments or arrangements"></textarea>
|
| 430 |
+
</div>
|
| 431 |
+
|
| 432 |
+
<div class="form-group">
|
| 433 |
+
<label for="keyFacts">Key Facts</label>
|
| 434 |
+
<textarea id="keyFacts" placeholder="Important facts to include in the song"></textarea>
|
| 435 |
+
</div>
|
| 436 |
+
|
| 437 |
+
<div class="form-group">
|
| 438 |
+
<label for="stories">Stories</label>
|
| 439 |
+
<textarea id="stories" placeholder="Any stories to include"></textarea>
|
| 440 |
+
</div>
|
| 441 |
+
|
| 442 |
+
<div class="form-group">
|
| 443 |
+
<label for="mainMessage">Main Message</label>
|
| 444 |
+
<textarea id="mainMessage" placeholder="The main message of the song"></textarea>
|
| 445 |
+
</div>
|
| 446 |
+
|
| 447 |
+
<div class="form-group">
|
| 448 |
+
<label for="namesPlaces">Names/Places</label>
|
| 449 |
+
<input type="text" id="namesPlaces" placeholder="Any specific names or places to mention">
|
| 450 |
+
</div>
|
| 451 |
+
|
| 452 |
+
<div class="form-group">
|
| 453 |
+
<label for="visualStyle">Visual Style</label>
|
| 454 |
+
<input type="text" id="visualStyle" placeholder="e.g., Realistic, Cartoon">
|
| 455 |
+
</div>
|
| 456 |
+
|
| 457 |
+
<div class="form-group">
|
| 458 |
+
<label for="visualMood">Visual Mood</label>
|
| 459 |
+
<input type="text" id="visualMood" placeholder="e.g., Bright, Dark">
|
| 460 |
+
</div>
|
| 461 |
+
|
| 462 |
+
<div class="form-group">
|
| 463 |
+
<label for="visualPlacesThemes">Visual Places/Themes</label>
|
| 464 |
+
<input type="text" id="visualPlacesThemes" placeholder="e.g., Beach, Mountains">
|
| 465 |
+
</div>
|
| 466 |
+
|
| 467 |
+
<div class="form-group">
|
| 468 |
+
<label for="visualText">Visual Text</label>
|
| 469 |
+
<input type="text" id="visualText" placeholder="Any text to include in visuals">
|
| 470 |
+
</div>
|
| 471 |
+
|
| 472 |
+
<div class="checkbox-group">
|
| 473 |
+
<input type="checkbox" id="wantsArtwork">
|
| 474 |
+
<label for="wantsArtwork">Wants Artwork</label>
|
| 475 |
+
</div>
|
| 476 |
+
|
| 477 |
+
<div class="checkbox-group">
|
| 478 |
+
<input type="checkbox" id="wantsVideo">
|
| 479 |
+
<label for="wantsVideo">Wants Video</label>
|
| 480 |
+
</div>
|
| 481 |
+
|
| 482 |
+
<div class="btn-group">
|
| 483 |
+
<button class="btn btn-primary" id="generateBtn">Generate Suno Block</button>
|
| 484 |
+
<button class="btn btn-secondary" id="copySunoBtn">Copy Suno Block</button>
|
| 485 |
+
</div>
|
| 486 |
+
|
| 487 |
+
<div class="form-group">
|
| 488 |
+
<label>Suno Block Output</label>
|
| 489 |
+
<div id="sunoBlockOut" class="output-area">Suno block will appear here...</div>
|
| 490 |
+
</div>
|
| 491 |
+
</div>
|
| 492 |
+
|
| 493 |
+
<div class="card">
|
| 494 |
+
<h2>Generated Prompts</h2>
|
| 495 |
+
<div class="form-group">
|
| 496 |
+
<label for="songPrompt">Song Prompt</label>
|
| 497 |
+
<textarea id="songPrompt" readonly></textarea>
|
| 498 |
+
</div>
|
| 499 |
+
|
| 500 |
+
<div class="form-group">
|
| 501 |
+
<label for="artPrompt">Artwork Prompt</label>
|
| 502 |
+
<textarea id="artPrompt" readonly></textarea>
|
| 503 |
+
</div>
|
| 504 |
+
|
| 505 |
+
<div class="form-group">
|
| 506 |
+
<label for="videoPrompt">Video Prompt</label>
|
| 507 |
+
<textarea id="videoPrompt" readonly></textarea>
|
| 508 |
+
</div>
|
| 509 |
+
</div>
|
| 510 |
+
|
| 511 |
+
<div class="card">
|
| 512 |
+
<h2>Image Generation</h2>
|
| 513 |
+
<div class="btn-group">
|
| 514 |
+
<button class="btn btn-primary" id="generateImageBtn">Generate Image</button>
|
| 515 |
+
</div>
|
| 516 |
+
<div id="imgGrid" class="output-area" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;"></div>
|
| 517 |
+
</div>
|
| 518 |
+
|
| 519 |
+
<div class="card">
|
| 520 |
+
<h2>Video Generation</h2>
|
| 521 |
+
<div class="btn-group">
|
| 522 |
+
<button class="btn btn-primary" id="generateVideoBtn">Generate Video</button>
|
| 523 |
+
</div>
|
| 524 |
+
<div id="videoPreview" class="output-area"></div>
|
| 525 |
+
<div id="videoOut" class="status-message"></div>
|
| 526 |
+
</div>
|
| 527 |
+
|
| 528 |
+
<div class="card">
|
| 529 |
+
<h2>File Upload</h2>
|
| 530 |
+
<div class="form-group">
|
| 531 |
+
<label>Song File</label>
|
| 532 |
+
<div class="file-upload" id="songFileUpload">
|
| 533 |
+
<i class="fas fa-upload fa-2x"></i>
|
| 534 |
+
<p>Click to upload song file (MP3, WAV, M4A)</p>
|
| 535 |
+
<input type="file" id="songFileInput" accept="audio/mp3,audio/wav,audio/m4a">
|
| 536 |
+
</div>
|
| 537 |
+
<div id="songFileInfo" class="file-info" style="display: none;">
|
| 538 |
+
<i class="fas fa-file-audio"></i>
|
| 539 |
+
<span id="songFileName"></span>
|
| 540 |
+
<button class="btn btn-danger" id="removeSongBtn" style="padding: 5px 10px;">Remove</button>
|
| 541 |
+
</div>
|
| 542 |
+
</div>
|
| 543 |
+
|
| 544 |
+
<div class="form-group">
|
| 545 |
+
<label>Video Clips (MP4)</label>
|
| 546 |
+
<div class="file-upload" id="clipFilesUpload">
|
| 547 |
+
<i class="fas fa-upload fa-2x"></i>
|
| 548 |
+
<p>Click to upload video clips (MP4)</p>
|
| 549 |
+
<input type="file" id="clipFilesInput" accept="video/mp4" multiple>
|
| 550 |
+
</div>
|
| 551 |
+
<div id="clipQueueWrap" class="file-info">
|
| 552 |
+
<div class="small" style="margin-top:6px">No clips queued.</div>
|
| 553 |
+
</div>
|
| 554 |
+
<div class="btn-group">
|
| 555 |
+
<button class="btn btn-danger" id="clearClipsBtn">Clear All Clips</button>
|
| 556 |
+
<button class="btn btn-primary" id="stitchClipsBtn">Stitch Clips</button>
|
| 557 |
+
</div>
|
| 558 |
+
</div>
|
| 559 |
+
<div id="uploadOut" class="status-message"></div>
|
| 560 |
+
</div>
|
| 561 |
+
</div>
|
| 562 |
+
|
| 563 |
+
<div class="processing-overlay" id="processingOverlay">
|
| 564 |
+
<div class="processing-content">
|
| 565 |
+
<div class="spinner"></div>
|
| 566 |
+
<div id="processingMessage">Processing...</div>
|
| 567 |
+
</div>
|
| 568 |
+
</div>
|
| 569 |
+
|
| 570 |
+
<script>
|
| 571 |
+
// Constants
|
| 572 |
+
const API_BASE = 'https://api.example.com'; // Replace with your actual API base URL
|
| 573 |
+
let apiKey = '';
|
| 574 |
+
let currentOrderId = null;
|
| 575 |
+
let songFile = null;
|
| 576 |
+
let videoClips = [];
|
| 577 |
+
|
| 578 |
+
// DOM Elements
|
| 579 |
+
const warningsDisplay = document.getElementById('warningsDisplay');
|
| 580 |
+
const apiStatus = document.getElementById('apiStatus');
|
| 581 |
+
const healthStatus = document.getElementById('healthStatus');
|
| 582 |
+
const diagOut = document.getElementById('diagOut');
|
| 583 |
+
const sunoBlockOut = document.getElementById('sunoBlockOut');
|
| 584 |
+
const orderIdDisplay = document.getElementById('orderIdDisplay');
|
| 585 |
+
const processingOverlay = document.getElementById('processingOverlay');
|
| 586 |
+
const processingMessage = document.getElementById('processingMessage');
|
| 587 |
+
const songFileInput = document.getElementById('songFileInput');
|
| 588 |
+
const songFileUpload = document.getElementById('songFileUpload');
|
| 589 |
+
const songFileInfo = document.getElementById('songFileInfo');
|
| 590 |
+
const songFileName = document.getElementById('songFileName');
|
| 591 |
+
const removeSongBtn = document.getElementById('removeSongBtn');
|
| 592 |
+
const clipFilesInput = document.getElementById('clipFilesInput');
|
| 593 |
+
const clipFilesUpload = document.getElementById('clipFilesUpload');
|
| 594 |
+
const clipQueueWrap = document.getElementById('clipQueueWrap');
|
| 595 |
+
const clearClipsBtn = document.getElementById('clearClipsBtn');
|
| 596 |
+
const stitchClipsBtn = document.getElementById('stitchClipsBtn');
|
| 597 |
+
const uploadOut = document.getElementById('uploadOut');
|
| 598 |
+
|
| 599 |
+
// Initialize the app
|
| 600 |
+
function init() {
|
| 601 |
+
// Load saved API key
|
| 602 |
+
const savedKey = localStorage.getItem('openaiApiKey');
|
| 603 |
+
if (savedKey) {
|
| 604 |
+
apiKey = savedKey;
|
| 605 |
+
document.getElementById('apiKey').value = '••••••••••••••••';
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
// Set up event listeners
|
| 609 |
+
document.getElementById('saveKeyBtn').addEventListener('click', saveApiKey);
|
| 610 |
+
document.getElementById('testKeyBtn').addEventListener('click', testApiKey);
|
| 611 |
+
document.getElementById('checkHealthBtn').addEventListener('click', checkServerHealth);
|
| 612 |
+
document.getElementById('runDiagnosticsBtn').addEventListener('click', runDiagnostics);
|
| 613 |
+
document.getElementById('randomizeBtn').addEventListener('click', randomizeForm);
|
| 614 |
+
document.getElementById('resetFormBtn').addEventListener('click', resetForm);
|
| 615 |
+
document.getElementById('saveDraftBtn').addEventListener('click', saveDraft);
|
| 616 |
+
document.getElementById('loadDraftBtn').addEventListener('click', loadDraft);
|
| 617 |
+
document.getElementById('generateBtn').addEventListener('click', generateSunoBlock);
|
| 618 |
+
document.getElementById('copySunoBtn').addEventListener('click', copySunoBlock);
|
| 619 |
+
document.getElementById('generateImageBtn').addEventListener('click', generateImage);
|
| 620 |
+
document.getElementById('generateVideoBtn').addEventListener('click', generateVideo);
|
| 621 |
+
songFileUpload.addEventListener('click', () => songFileInput.click());
|
| 622 |
+
songFileInput.addEventListener('change', handleSongFileUpload);
|
| 623 |
+
removeSongBtn.addEventListener('click', removeSongFile);
|
| 624 |
+
clipFilesUpload.addEventListener('click', () => clipFilesInput.click());
|
| 625 |
+
clipFilesInput.addEventListener('change', handleClipFilesUpload);
|
| 626 |
+
clearClipsBtn.addEventListener('click', clearClips);
|
| 627 |
+
stitchClipsBtn.addEventListener('click', stitchClips);
|
| 628 |
+
|
| 629 |
+
// Initialize file upload areas
|
| 630 |
+
updateFileUploadAreas();
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
// Update file upload areas
|
| 634 |
+
function updateFileUploadAreas() {
|
| 635 |
+
// Song file upload
|
| 636 |
+
songFileUpload.addEventListener('dragover', (e) => {
|
| 637 |
+
e.preventDefault();
|
| 638 |
+
songFileUpload.style.borderColor = var(--primary);
|
| 639 |
+
});
|
| 640 |
+
|
| 641 |
+
songFileUpload.addEventListener('dragleave', () => {
|
| 642 |
+
songFileUpload.style.borderColor = var(--border);
|
| 643 |
+
});
|
| 644 |
+
|
| 645 |
+
songFileUpload.addEventListener('drop', (e) => {
|
| 646 |
+
e.preventDefault();
|
| 647 |
+
songFileUpload.style.borderColor = var(--border);
|
| 648 |
+
songFileInput.files = e.dataTransfer.files;
|
| 649 |
+
handleSongFileUpload();
|
| 650 |
+
});
|
| 651 |
+
|
| 652 |
+
// Clip files upload
|
| 653 |
+
clipFilesUpload.addEventListener('dragover', (e) => {
|
| 654 |
+
e.preventDefault();
|
| 655 |
+
clipFilesUpload.style.borderColor = var(--primary);
|
| 656 |
+
});
|
| 657 |
+
|
| 658 |
+
clipFilesUpload.addEventListener('dragleave', () => {
|
| 659 |
+
clipFilesUpload.style.borderColor = var(--border);
|
| 660 |
+
});
|
| 661 |
+
|
| 662 |
+
clipFilesUpload.addEventListener('drop', (e) => {
|
| 663 |
+
e.preventDefault();
|
| 664 |
+
clipFilesUpload.style.borderColor = var(--border);
|
| 665 |
+
clipFilesInput.files = e.dataTransfer.files;
|
| 666 |
+
handleClipFilesUpload();
|
| 667 |
+
});
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
// Save API key
|
| 671 |
+
function saveApiKey() {
|
| 672 |
+
const keyInput = document.getElementById('apiKey');
|
| 673 |
+
const keyValue = keyInput.value.trim();
|
| 674 |
+
|
| 675 |
+
if (!keyValue) {
|
| 676 |
+
showStatus(apiStatus, 'Please enter an API key', 'error');
|
| 677 |
+
return;
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
// Simple validation - should start with 'sk-' and be at least 40 characters
|
| 681 |
+
if (!keyValue.startsWith('sk-') || keyValue.length < 40) {
|
| 682 |
+
showStatus(apiStatus, 'Invalid API key format', 'error');
|
| 683 |
+
return;
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
apiKey = keyValue;
|
| 687 |
+
localStorage.setItem('openaiApiKey', apiKey);
|
| 688 |
+
keyInput.value = '••••••••••••••••';
|
| 689 |
+
showStatus(apiStatus, 'API key saved successfully!', 'success');
|
| 690 |
+
}
|
| 691 |
+
|
| 692 |
+
// Test API key
|
| 693 |
+
async function testApiKey() {
|
| 694 |
+
if (!apiKey) {
|
| 695 |
+
showStatus(apiStatus, 'Please save your API key first!', 'error');
|
| 696 |
+
return;
|
| 697 |
+
}
|
| 698 |
+
|
| 699 |
+
try {
|
| 700 |
+
showProcessing('Testing API key...');
|
| 701 |
+
|
| 702 |
+
// Mock API call - replace with actual API endpoint
|
| 703 |
+
const response = await fetch(`${API_BASE}/test-key`, {
|
| 704 |
+
method: 'POST',
|
| 705 |
+
headers: {
|
| 706 |
+
'Content-Type': 'application/json',
|
| 707 |
+
'Authorization': `Bearer ${apiKey}`
|
| 708 |
+
}
|
| 709 |
+
});
|
| 710 |
+
|
| 711 |
+
if (!response.ok) {
|
| 712 |
+
const errorData = await response.json();
|
| 713 |
+
throw new Error(errorData.error || 'API key test failed');
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
const result = await response.json();
|
| 717 |
+
showStatus(apiStatus, 'API key is valid!', 'success');
|
| 718 |
+
} catch (error) {
|
| 719 |
+
showStatus(apiStatus, `API key test failed: ${error.message}`, 'error');
|
| 720 |
+
console.error('API key test error:', error);
|
| 721 |
+
} finally {
|
| 722 |
+
hideProcessing();
|
| 723 |
+
}
|
| 724 |
+
}
|
| 725 |
+
|
| 726 |
+
// Check server health
|
| 727 |
+
async function checkServerHealth() {
|
| 728 |
+
try {
|
| 729 |
+
showProcessing('Checking server health...');
|
| 730 |
+
|
| 731 |
+
const response = await fetch(`${API_BASE}/health`);
|
| 732 |
+
if (!response.ok) throw new Error('Server health check failed');
|
| 733 |
+
|
| 734 |
+
const healthData = await response.json();
|
| 735 |
+
showStatus(healthStatus, `Server is healthy! (${healthData.status})`, 'success');
|
| 736 |
+
} catch (error) {
|
| 737 |
+
showStatus(healthStatus, `Server health check failed: ${error.message}`, 'error');
|
| 738 |
+
console.error('Health check error:', error);
|
| 739 |
+
} finally {
|
| 740 |
+
hideProcessing();
|
| 741 |
+
}
|
| 742 |
+
}
|
| 743 |
+
|
| 744 |
+
// Show status message
|
| 745 |
+
function showStatus(element, message, type) {
|
| 746 |
+
element.textContent = message;
|
| 747 |
+
element.className = `status-message status-${type}`;
|
| 748 |
+
element.style.display = 'block';
|
| 749 |
+
|
| 750 |
+
// Hide after 5 seconds
|
| 751 |
+
setTimeout(() => {
|
| 752 |
+
element.style.display = 'none';
|
| 753 |
+
}, 5000);
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
// Get form data
|
| 757 |
+
function getFormData() {
|
| 758 |
+
return {
|
| 759 |
+
songTitle: document.getElementById('songTitle').value,
|
| 760 |
+
occasion: document.getElementById('occasion').value,
|
| 761 |
+
customerName: document.getElementById('buyerName').value,
|
| 762 |
+
recipient_name: document.getElementById('recipientName').value,
|
| 763 |
+
relationship: document.getElementById('relationship').value,
|
| 764 |
+
tone_vibe: document.getElementById('tone').value,
|
| 765 |
+
main_genre: document.getElementById('mainGenre').value,
|
| 766 |
+
secondary_influences: document.getElementById('secondaryGenres').value,
|
| 767 |
+
tempo_energy: document.getElementById('tempo').value,
|
| 768 |
+
vocal_style: document.getElementById('vocalStyle').value,
|
| 769 |
+
instrumentation_notes: document.getElementById('instrumentationNotes').value,
|
| 770 |
+
language_level: document.getElementById('languageLevel').value,
|
| 771 |
+
package_level: document.getElementById('packageLevel').value,
|
| 772 |
+
key_facts: document.getElementById('keyFacts').value,
|
| 773 |
+
stories: document.getElementById('stories').value,
|
| 774 |
+
main_message: document.getElementById('mainMessage').value,
|
| 775 |
+
names_places: document.getElementById('namesPlaces').value,
|
| 776 |
+
visual_style: document.getElementById('visualStyle').value,
|
| 777 |
+
visual_mood: document.getElementById('visualMood').value,
|
| 778 |
+
visual_places_themes: document.getElementById('visualPlacesThemes').value,
|
| 779 |
+
visual_text: document.getElementById('visualText').value,
|
| 780 |
+
wants_artwork: document.getElementById('wantsArtwork').checked,
|
| 781 |
+
wants_video: document.getElementById('wantsVideo').checked
|
| 782 |
+
};
|
| 783 |
+
}
|
| 784 |
+
|
| 785 |
+
// Generate Suno block
|
| 786 |
+
async function generateSunoBlock() {
|
| 787 |
+
const formData = getFormData();
|
| 788 |
+
|
| 789 |
+
// Basic validation
|
| 790 |
+
if (!formData.songTitle || !formData.customerName || !formData.recipient_name) {
|
| 791 |
+
showStatus(warningsDisplay, 'Please fill in required fields (Song Title, Buyer Name, Recipient Name)', 'error');
|
| 792 |
+
return;
|
| 793 |
+
}
|
| 794 |
+
|
| 795 |
+
try {
|
| 796 |
+
showProcessing('Generating Suno block...');
|
| 797 |
+
|
| 798 |
+
// Mock API call - replace with actual API endpoint
|
| 799 |
+
const response = await fetch(`${API_BASE}/generate`, {
|
| 800 |
+
method: 'POST',
|
| 801 |
+
headers: {
|
| 802 |
+
'Content-Type': 'application/json',
|
| 803 |
+
'X-API-Key': apiKey
|
| 804 |
+
},
|
| 805 |
+
body: JSON.stringify(formData)
|
| 806 |
+
});
|
| 807 |
+
|
| 808 |
+
if (!response.ok) {
|
| 809 |
+
const errorData = await response.json();
|
| 810 |
+
throw new Error(errorData.error || 'Generation failed');
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
const result = await response.json();
|
| 814 |
+
currentOrderId = result.orderId;
|
| 815 |
+
orderIdDisplay.textContent = currentOrderId;
|
| 816 |
+
|
| 817 |
+
// Display the Suno block
|
| 818 |
+
sunoBlockOut.textContent = result.sunoBlock;
|
| 819 |
+
|
| 820 |
+
// Generate prompts
|
| 821 |
+
document.getElementById('songPrompt').value = result.songPrompt;
|
| 822 |
+
document.getElementById('artPrompt').value = result.artPrompt;
|
| 823 |
+
document.getElementById('videoPrompt').value = result.videoPrompt;
|
| 824 |
+
|
| 825 |
+
showStatus(warningsDisplay, 'Suno block generated successfully!', 'success');
|
| 826 |
+
} catch (error) {
|
| 827 |
+
showStatus(warningsDisplay, `Error generating Suno block: ${error.message}`, 'error');
|
| 828 |
+
console.error('Generation error:', error);
|
| 829 |
+
} finally {
|
| 830 |
+
hideProcessing();
|
| 831 |
+
}
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
// Randomize form
|
| 835 |
+
async function randomizeForm() {
|
| 836 |
+
try {
|
| 837 |
+
showProcessing('Randomizing form...');
|
| 838 |
+
|
| 839 |
+
// Mock API call - replace with actual API endpoint
|
| 840 |
+
const response = await fetch(`${API_BASE}/randomize`);
|
| 841 |
+
if (!response.ok) throw new Error('Failed to randomize');
|
| 842 |
+
|
| 843 |
+
const randomData = await response.json();
|
| 844 |
+
|
| 845 |
+
// Fill form fields with random data
|
| 846 |
+
document.getElementById('songTitle').value = randomData.songTitle;
|
| 847 |
+
document.getElementById('occasion').value = randomData.occasion;
|
| 848 |
+
document.getElementById('buyerName').value = randomData.buyerName;
|
| 849 |
+
document.getElementById('recipientName').value = randomData.recipientName;
|
| 850 |
+
document.getElementById('relationship').value = randomData.relationship;
|
| 851 |
+
document.getElementById('tone').value = randomData.tone;
|
| 852 |
+
document.getElementById('mainGenre').value = randomData.mainGenre;
|
| 853 |
+
document.getElementById('secondaryGenres').value = randomData.secondaryGenres;
|
| 854 |
+
document.getElementById('tempo').value = randomData.tempo;
|
| 855 |
+
document.getElementById('vocalStyle').value = randomData.vocalStyle;
|
| 856 |
+
document.getElementById('instrumentationNotes').value = randomData.instrumentationNotes;
|
| 857 |
+
document.getElementById('keyFacts').value = randomData.keyFacts.join('\n');
|
| 858 |
+
document.getElementById('stories').value = randomData.stories.join('\n');
|
| 859 |
+
document.getElementById('mainMessage').value = randomData.mainMessage;
|
| 860 |
+
document.getElementById('namesPlaces').value = randomData.namesPlaces;
|
| 861 |
+
document.getElementById('visualStyle').value = randomData.visualStyle;
|
| 862 |
+
document.getElementById('visualMood').value = randomData.visualMood;
|
| 863 |
+
document.getElementById('visualPlacesThemes').value = randomData.visualPlacesThemes;
|
| 864 |
+
document.getElementById('visualText').value = randomData.visualText;
|
| 865 |
+
|
| 866 |
+
showStatus(warningsDisplay, 'Form randomized with API data!', 'success');
|
| 867 |
+
} catch (error) {
|
| 868 |
+
showStatus(warningsDisplay, `Error randomizing: ${error.message}`, 'error');
|
| 869 |
+
console.error('Randomization error:', error);
|
| 870 |
+
} finally {
|
| 871 |
+
hideProcessing();
|
| 872 |
+
}
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
// Reset form
|
| 876 |
+
function resetForm() {
|
| 877 |
+
if (confirm('Are you sure you want to reset the form? All data will be lost.')) {
|
| 878 |
+
document.querySelectorAll('input, textarea, select').forEach(el => {
|
| 879 |
+
if (el.type === 'checkbox') {
|
| 880 |
+
el.checked = false;
|
| 881 |
+
} else {
|
| 882 |
+
el.value = '';
|
| 883 |
+
}
|
| 884 |
+
});
|
| 885 |
+
|
| 886 |
+
sunoBlockOut.textContent = 'Suno block will appear here...';
|
| 887 |
+
warningsDisplay.textContent = '';
|
| 888 |
+
diagOut.textContent = '';
|
| 889 |
+
currentOrderId = null;
|
| 890 |
+
orderIdDisplay.textContent = 'none';
|
| 891 |
+
document.getElementById('songPrompt').value = '';
|
| 892 |
+
document.getElementById('artPrompt').value = '';
|
| 893 |
+
document.getElementById('videoPrompt').value = '';
|
| 894 |
+
document.getElementById('imgGrid').innerHTML = '';
|
| 895 |
+
document.getElementById('videoPreview').innerHTML = '';
|
| 896 |
+
document.getElementById('videoOut').textContent = 'Video status...';
|
| 897 |
+
|
| 898 |
+
showStatus(warningsDisplay, 'Form reset complete!', 'success');
|
| 899 |
+
}
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
// Save draft
|
| 903 |
+
function saveDraft() {
|
| 904 |
+
const draft = {
|
| 905 |
+
formData: getFormData(),
|
| 906 |
+
sunoBlock: sunoBlockOut.textContent,
|
| 907 |
+
songPrompt: document.getElementById('songPrompt').value,
|
| 908 |
+
artPrompt: document.getElementById('artPrompt').value,
|
| 909 |
+
videoPrompt: document.getElementById('videoPrompt').value,
|
| 910 |
+
orderId: currentOrderId
|
| 911 |
+
};
|
| 912 |
+
|
| 913 |
+
localStorage.setItem('fiverrMusicDraft', JSON.stringify(draft));
|
| 914 |
+
showStatus(warningsDisplay, 'Draft saved to browser storage!', 'success');
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
// Load draft
|
| 918 |
+
function loadDraft() {
|
| 919 |
+
const draftData = localStorage.getItem('fiverrMusicDraft');
|
| 920 |
+
if (!draftData) {
|
| 921 |
+
showStatus(warningsDisplay, 'No saved draft found!', 'warning');
|
| 922 |
+
return;
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
try {
|
| 926 |
+
const draft = JSON.parse(draftData);
|
| 927 |
+
|
| 928 |
+
// Restore form data
|
| 929 |
+
document.getElementById('songTitle').value = draft.formData.songTitle;
|
| 930 |
+
document.getElementById('occasion').value = draft.formData.occasion;
|
| 931 |
+
document.getElementById('buyerName').value = draft.formData.customerName;
|
| 932 |
+
document.getElementById('recipientName').value = draft.formData.recipient_name;
|
| 933 |
+
document.getElementById('relationship').value = draft.formData.relationship;
|
| 934 |
+
document.getElementById('tone').value = draft.formData.tone_vibe;
|
| 935 |
+
document.getElementById('mainGenre').value = draft.formData.main_genre;
|
| 936 |
+
document.getElementById('secondaryGenres').value = draft.formData.secondary_influences;
|
| 937 |
+
document.getElementById('tempo').value = draft.formData.tempo_energy;
|
| 938 |
+
document.getElementById('vocalStyle').value = draft.formData.vocal_style;
|
| 939 |
+
document.getElementById('instrumentationNotes').value = draft.formData.instrumentation_notes;
|
| 940 |
+
document.getElementById('languageLevel').value = draft.formData.language_level;
|
| 941 |
+
document.getElementById('packageLevel').value = draft.formData.package_level;
|
| 942 |
+
document.getElementById('keyFacts').value = draft.formData.key_facts;
|
| 943 |
+
document.getElementById('stories').value = draft.formData.stories;
|
| 944 |
+
document.getElementById('mainMessage').value = draft.formData.main_message;
|
| 945 |
+
document.getElementById('namesPlaces').value = draft.formData.names_places;
|
| 946 |
+
document.getElementById('visualStyle').value = draft.formData.visual_style;
|
| 947 |
+
document.getElementById('visualMood').value = draft.formData.visual_mood;
|
| 948 |
+
document.getElementById('visualPlacesThemes').value = draft.formData.visual_places_themes;
|
| 949 |
+
document.getElementById('visualText').value = draft.formData.visual_text;
|
| 950 |
+
document.getElementById('wantsArtwork').checked = draft.formData.wants_artwork;
|
| 951 |
+
document.getElementById('wantsVideo').checked = draft.formData.wants_video;
|
| 952 |
+
|
| 953 |
+
// Restore generated content
|
| 954 |
+
sunoBlockOut.textContent = draft.sunoBlock;
|
| 955 |
+
document.getElementById('songPrompt').value = draft.songPrompt;
|
| 956 |
+
document.getElementById('artPrompt').value = draft.artPrompt;
|
| 957 |
+
document.getElementById('videoPrompt').value = draft.videoPrompt;
|
| 958 |
+
currentOrderId = draft.orderId;
|
| 959 |
+
orderIdDisplay.textContent = currentOrderId;
|
| 960 |
+
|
| 961 |
+
showStatus(warningsDisplay, 'Draft loaded successfully!', 'success');
|
| 962 |
+
} catch (error) {
|
| 963 |
+
showStatus(warningsDisplay, `Error loading draft: ${error.message}`, 'error');
|
| 964 |
+
console.error('Draft load error:', error);
|
| 965 |
+
}
|
| 966 |
+
}
|
| 967 |
+
|
| 968 |
+
// Copy Suno block to clipboard
|
| 969 |
+
function copySunoBlock() {
|
| 970 |
+
copyToClipboard(sunoBlockOut.textContent);
|
| 971 |
+
showStatus(warningsDisplay, 'Suno block copied to clipboard!', 'success');
|
| 972 |
+
}
|
| 973 |
+
|
| 974 |
+
// Run diagnostics
|
| 975 |
+
async function runDiagnostics() {
|
| 976 |
+
try {
|
| 977 |
+
showProcessing('Running diagnostics...');
|
| 978 |
+
|
| 979 |
+
const response = await fetch(`${API_BASE}/diagnostics`);
|
| 980 |
+
if (!response.ok) throw new Error('Diagnostics failed');
|
| 981 |
+
|
| 982 |
+
const diagData = await response.json();
|
| 983 |
+
diagOut.textContent = JSON.stringify(diagData, null, 2);
|
| 984 |
+
diagOut.style.display = 'block';
|
| 985 |
+
|
| 986 |
+
showStatus(warningsDisplay, 'Diagnostics complete!', 'success');
|
| 987 |
+
} catch (error) {
|
| 988 |
+
diagOut.textContent = `Error running diagnostics: ${error.message}`;
|
| 989 |
+
diagOut.style.display = 'block';
|
| 990 |
+
console.error('Diagnostics error:', error);
|
| 991 |
+
} finally {
|
| 992 |
+
hideProcessing();
|
| 993 |
+
}
|
| 994 |
+
}
|
| 995 |
+
|
| 996 |
+
// Generate image
|
| 997 |
+
async function generateImage() {
|
| 998 |
+
if (!apiKey) {
|
| 999 |
+
showStatus(warningsDisplay, 'Please save your OpenAI API key first!', 'error');
|
| 1000 |
+
return;
|
| 1001 |
+
}
|
| 1002 |
+
|
| 1003 |
+
const prompt = document.getElementById('artPrompt').value;
|
| 1004 |
+
if (!prompt) {
|
| 1005 |
+
showStatus(warningsDisplay, 'Please generate an artwork prompt first!', 'error');
|
| 1006 |
+
return;
|
| 1007 |
+
}
|
| 1008 |
+
|
| 1009 |
+
try {
|
| 1010 |
+
showProcessing('Generating image...');
|
| 1011 |
+
|
| 1012 |
+
const response = await fetch(`${API_BASE}/generate/image`, {
|
| 1013 |
+
method: 'POST',
|
| 1014 |
+
headers: {
|
| 1015 |
+
'Content-Type': 'application/json',
|
| 1016 |
+
'X-API-Key': apiKey
|
| 1017 |
+
},
|
| 1018 |
+
body: JSON.stringify({ prompt })
|
| 1019 |
+
});
|
| 1020 |
+
|
| 1021 |
+
if (!response.ok) {
|
| 1022 |
+
const errorData = await response.json();
|
| 1023 |
+
throw new Error(errorData.error || 'Image generation failed');
|
| 1024 |
+
}
|
| 1025 |
+
|
| 1026 |
+
const result = await response.json();
|
| 1027 |
+
displayGeneratedImages(result.images);
|
| 1028 |
+
|
| 1029 |
+
showStatus(warningsDisplay, 'Image generation complete!', 'success');
|
| 1030 |
+
} catch (error) {
|
| 1031 |
+
showStatus(warningsDisplay, `Error generating image: ${error.message}`, 'error');
|
| 1032 |
+
console.error('Image generation error:', error);
|
| 1033 |
+
} finally {
|
| 1034 |
+
hideProcessing();
|
| 1035 |
+
}
|
| 1036 |
+
}
|
| 1037 |
+
|
| 1038 |
+
// Display generated images
|
| 1039 |
+
function displayGeneratedImages(images) {
|
| 1040 |
+
const imgGrid = document.getElementById('imgGrid');
|
| 1041 |
+
imgGrid.innerHTML = '';
|
| 1042 |
+
|
| 1043 |
+
images.forEach((imgUrl, index) => {
|
| 1044 |
+
const imgContainer = document.createElement('div');
|
| 1045 |
+
imgContainer.className = 'thumb-container';
|
| 1046 |
+
|
| 1047 |
+
const img = document.createElement('img');
|
| 1048 |
+
img.src = imgUrl;
|
| 1049 |
+
img.className = 'thumb';
|
| 1050 |
+
img.alt = `Generated image ${index + 1}`;
|
| 1051 |
+
|
| 1052 |
+
const downloadBtn = document.createElement('button');
|
| 1053 |
+
downloadBtn.className = 'miniBtn';
|
| 1054 |
+
downloadBtn.textContent = 'Download';
|
| 1055 |
+
downloadBtn.addEventListener('click', () => {
|
| 1056 |
+
downloadImage(imgUrl, `generated-image-${index + 1}.png`);
|
| 1057 |
+
});
|
| 1058 |
+
|
| 1059 |
+
imgContainer.appendChild(img);
|
| 1060 |
+
imgContainer.appendChild(downloadBtn);
|
| 1061 |
+
imgGrid.appendChild(imgContainer);
|
| 1062 |
+
});
|
| 1063 |
+
}
|
| 1064 |
+
|
| 1065 |
+
// Generate video
|
| 1066 |
+
async function generateVideo() {
|
| 1067 |
+
if (!apiKey) {
|
| 1068 |
+
showStatus(warningsDisplay, 'Please save your OpenAI API key first!', 'error');
|
| 1069 |
+
return;
|
| 1070 |
+
}
|
| 1071 |
+
|
| 1072 |
+
const prompt = document.getElementById('videoPrompt').value;
|
| 1073 |
+
if (!prompt) {
|
| 1074 |
+
showStatus(warningsDisplay, 'Please generate a video prompt first!', 'error');
|
| 1075 |
+
return;
|
| 1076 |
+
}
|
| 1077 |
+
|
| 1078 |
+
try {
|
| 1079 |
+
showProcessing('Generating video...');
|
| 1080 |
+
|
| 1081 |
+
const response = await fetch(`${API_BASE}/generate/video`, {
|
| 1082 |
+
method: 'POST',
|
| 1083 |
+
headers: {
|
| 1084 |
+
'Content-Type': 'application/json',
|
| 1085 |
+
'X-API-Key': apiKey
|
| 1086 |
+
},
|
| 1087 |
+
body: JSON.stringify({ prompt })
|
| 1088 |
+
});
|
| 1089 |
+
|
| 1090 |
+
if (!response.ok) {
|
| 1091 |
+
const errorData = await response.json();
|
| 1092 |
+
throw new Error(errorData.error || 'Video generation failed');
|
| 1093 |
+
}
|
| 1094 |
+
|
| 1095 |
+
const result = await response.json();
|
| 1096 |
+
displayVideoPreview(result.videoUrl);
|
| 1097 |
+
|
| 1098 |
+
showStatus(warningsDisplay, 'Video generation complete!', 'success');
|
| 1099 |
+
} catch (error) {
|
| 1100 |
+
showStatus(warningsDisplay, `Error generating video: ${error.message}`, 'error');
|
| 1101 |
+
console.error('Video generation error:', error);
|
| 1102 |
+
} finally {
|
| 1103 |
+
hideProcessing();
|
| 1104 |
+
}
|
| 1105 |
+
}
|
| 1106 |
+
|
| 1107 |
+
// Display video preview
|
| 1108 |
+
function displayVideoPreview(videoUrl) {
|
| 1109 |
+
const videoPreview = document.getElementById('videoPreview');
|
| 1110 |
+
videoPreview.innerHTML = '';
|
| 1111 |
+
|
| 1112 |
+
const video = document.createElement('video');
|
| 1113 |
+
video.src = videoUrl;
|
| 1114 |
+
video.controls = true;
|
| 1115 |
+
video.style.width = '100%';
|
| 1116 |
+
video.style.borderRadius = '12px';
|
| 1117 |
+
|
| 1118 |
+
const downloadBtn = document.createElement('button');
|
| 1119 |
+
downloadBtn.className = 'miniBtn';
|
| 1120 |
+
downloadBtn.textContent = 'Download Video';
|
| 1121 |
+
downloadBtn.style.marginTop = '10px';
|
| 1122 |
+
downloadBtn.addEventListener('click', () => {
|
| 1123 |
+
downloadFile(videoUrl, 'generated-video.mp4');
|
| 1124 |
+
});
|
| 1125 |
+
|
| 1126 |
+
videoPreview.appendChild(video);
|
| 1127 |
+
videoPreview.appendChild(downloadBtn);
|
| 1128 |
+
|
| 1129 |
+
document.getElementById('videoOut').textContent = 'Video ready for download!';
|
| 1130 |
+
}
|
| 1131 |
+
|
| 1132 |
+
// Handle song file upload
|
| 1133 |
+
function handleSongFileUpload() {
|
| 1134 |
+
const file = songFileInput.files[0];
|
| 1135 |
+
if (!file) return;
|
| 1136 |
+
|
| 1137 |
+
if (!['audio/mp3', 'audio/wav', 'audio/m4a'].includes(file.type)) {
|
| 1138 |
+
showStatus(warningsDisplay, 'Please upload a valid audio file (MP3, WAV, or M4A)', 'error');
|
| 1139 |
+
return;
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
songFile = file;
|
| 1143 |
+
songFileName.textContent = file.name;
|
| 1144 |
+
songFileInfo.style.display = 'flex';
|
| 1145 |
+
showStatus(warningsDisplay, 'Song file uploaded successfully!', 'success');
|
| 1146 |
+
}
|
| 1147 |
+
|
| 1148 |
+
// Remove song file
|
| 1149 |
+
function removeSongFile() {
|
| 1150 |
+
songFile = null;
|
| 1151 |
+
songFileInput.value = '';
|
| 1152 |
+
songFileInfo.style.display = 'none';
|
| 1153 |
+
showStatus(warningsDisplay, 'Song file removed!', 'success');
|
| 1154 |
+
}
|
| 1155 |
+
|
| 1156 |
+
// Handle clip files upload
|
| 1157 |
+
function handleClipFilesUpload() {
|
| 1158 |
+
const files = Array.from(clipFilesInput.files);
|
| 1159 |
+
if (files.length === 0) return;
|
| 1160 |
+
|
| 1161 |
+
const invalidFiles = files.filter(file => file.type !== 'video/mp4');
|
| 1162 |
+
if (invalidFiles.length > 0) {
|
| 1163 |
+
showStatus(warningsDisplay, 'Only MP4 files are allowed for video clips!', 'error');
|
| 1164 |
+
return;
|
| 1165 |
+
}
|
| 1166 |
+
|
| 1167 |
+
videoClips = [...videoClips, ...files];
|
| 1168 |
+
updateClipQueue();
|
| 1169 |
+
showStatus(warnings
|