File size: 15,340 Bytes
2ff27b3 0781beb 2463e1a 0781beb 2ff27b3 0781beb e9d505f 0781beb 2ff27b3 0781beb 2ff27b3 0781beb 2ff27b3 c3bc67b 2ff27b3 c3bc67b 2ff27b3 c3bc67b 2ff27b3 c3bc67b 0781beb 2ff27b3 0781beb 2ff27b3 0781beb 2ff27b3 0781beb 2ff27b3 0781beb 2ff27b3 0781beb c3bc67b 0781beb a72fcc5 2463e1a a72fcc5 2ff27b3 0781beb 2ff27b3 0781beb e9d505f 0781beb e9d505f 0781beb 2ff27b3 0781beb 2ff27b3 e3ae503 2ff27b3 0781beb 2ff27b3 0781beb c3bc67b 0781beb afa190e c3bc67b afa190e 1ba0b41 c3bc67b 2ff27b3 4b64958 f92e788 2ff27b3 0e1c0be f92e788 0e1c0be c3bc67b f92e788 c3bc67b afa190e f92e788 4b64958 f92e788 afa190e f92e788 1ba0b41 0e1c0be f92e788 4b64958 0e1c0be 1ba0b41 c3bc67b 2ff27b3 e9d505f 1ba0b41 |
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 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FastAPI App</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css">
<link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@100&display=swap" rel="stylesheet">
<style>
html, body {
margin: 0;
padding: 0;
box-sizing: border-box;
overflow-x: hidden !important;
}
body {
background-color: #000000;
margin: 0;
}
#cont {
border: 2px solid blue;
width: 265px;
height: 50px;
display: flex;
flex-direction: column;
margin: auto;
margin-top: 30px;
padding-bottom: 7px;
gap: 14px;
background: linear-gradient(black , black) padding-box,
linear-gradient(to right, red, blue) border-box;
border-radius: 20px;
border: 2.5px solid transparent;
}
#prompt {
flex-grow: 1;
padding: 10px;
margin: 10px;
background: transparent;
border: none;
border-radius: 8px;
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
color: #fff;
outline: none;
}
#generatePrompts {
background-image: linear-gradient(
45deg,
hsl(240deg 75% 29%) 0%,
hsl(254deg 78% 28%) 6%,
hsl(264deg 82% 27%) 13%,
hsl(272deg 87% 26%) 19%,
hsl(278deg 93% 25%) 25%,
hsl(284deg 98% 24%) 31%,
hsl(289deg 100% 23%) 37%,
hsl(294deg 100% 23%) 44%,
hsl(299deg 100% 22%) 50%,
hsl(303deg 100% 23%) 56%,
hsl(307deg 100% 24%) 63%,
hsl(311deg 100% 25%) 69%,
hsl(313deg 100% 26%) 75%,
hsl(316deg 95% 28%) 81%,
hsl(320deg 88% 30%) 87%,
hsl(323deg 81% 32%) 94%,
hsl(326deg 75% 33%) 100%
);
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-top: 10px;
cursor: pointer;
border-radius: 5px;
display: block;
margin: 0 auto;
width: 200px;
}
#generatePrompts:hover {
/* Hover effect for the button */
background-color: #45a049;
}
}
.container {
text-align: center;
}
h1 {
text-align: center;
margin-bottom: 20px;
font-family: 'Barlow Condensed';
color: pink;
font-size: 40px; /* Adjust the font size as needed */
}
#inputs {
flex-grow: 1;
padding: 10px;
margin: 10px;
background: transparent;
border: none;
border-radius: 8px;
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
color: #fff;
outline: none;
}
.spinner {
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top: 3px solid #ffffff;
width: 20px;
height: 20px;
animation: spin 2s linear infinite;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#noise_level {
flex-grow: 1;
padding: 10px;
margin: 10px;
background: transparent;
border: none;
border-radius: 8px;
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
color: #fff;
outline: none;
}
#resultContainer p {
font-size: 20px;
color: white;
text-align :center ;
}
#showadv {
padding: 10px 20px;
/* Auto margin for centering horizontally */
background-image: linear-gradient(
45deg,
hsl(240deg 75% 29%) 0%,
hsl(254deg 78% 28%) 6%,
hsl(264deg 82% 27%) 13%,
hsl(272deg 87% 26%) 19%,
hsl(278deg 93% 25%) 25%,
hsl(284deg 98% 24%) 31%,
hsl(289deg 100% 23%) 37%,
hsl(294deg 100% 23%) 44%,
hsl(299deg 100% 22%) 50%,
hsl(303deg 100% 23%) 56%,
hsl(307deg 100% 24%) 63%,
hsl(311deg 100% 25%) 69%,
hsl(313deg 100% 26%) 75%,
hsl(316deg 95% 28%) 81%,
hsl(320deg 88% 30%) 87%,
hsl(323deg 81% 32%) 94%,
hsl(326deg 75% 33%) 100%
);
border: none;
border-radius: 8px;
cursor: pointer;
color: #fff;
text-align: center;
display: inline-block;
margin: 0 auto;
width: 200px;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-top: 10px;
cursor: pointer;
border-radius: 5px;
display: block;
margin: 0 auto;
width: 200px;
}
#advanced-options {
flex-grow: 1;
padding: 10px;
margin: 10px;
background: transparent;
border: none;
border-radius: 8px;
box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
color: #fff;
outline: none;
background-color: #030303;
padding: 0px;
border-radius: 12px;
box-shadow: 8px 8px 16px #050505, -8px -8px 16px #080808;
display: none;
align-items: center;
border: 2px solid rgb(247, 6, 187);
text-align :center ;
}
#advanced-options label, #advanced-options input {
margin: 10px;
color: #fff;
}
#advanced-options input[type="number"] {
width: 50px;
padding: 5px;
}
#advanced-options button {
padding: 10px 20px;
/* Auto margin for centering horizontally */
background-image: linear-gradient(
45deg,
hsl(240deg 75% 29%) 0%,
hsl(254deg 78% 28%) 6%,
hsl(264deg 82% 27%) 13%,
hsl(272deg 87% 26%) 19%,
hsl(278deg 93% 25%) 25%,
hsl(284deg 98% 24%) 31%,
hsl(289deg 100% 23%) 37%,
hsl(294deg 100% 23%) 44%,
hsl(299deg 100% 22%) 50%,
hsl(303deg 100% 23%) 56%,
hsl(307deg 100% 24%) 63%,
hsl(311deg 100% 25%) 69%,
hsl(313deg 100% 26%) 75%,
hsl(316deg 95% 28%) 81%,
hsl(320deg 88% 30%) 87%,
hsl(323deg 81% 32%) 94%,
hsl(326deg 75% 33%) 100%
);
border: none;
border-radius: 8px;
cursor: pointer;
color: #fff;
text-align: center;
display: inline-block;
margin: 0 auto;
width: 50px;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-top: 10px;
cursor: pointer;
border-radius: 5px;
display: block;
margin: 0 auto;
width: 200px;
}
#advanced-options button:hover {
background: linear-gradient(145deg, #00ffab, #4e00f9, rgb(255, 0, 43));
}
#generate {
background-image: linear-gradient(
45deg,
hsl(240deg 75% 29%) 0%,
hsl(254deg 78% 28%) 6%,
hsl(264deg 82% 27%) 13%,
hsl(272deg 87% 26%) 19%,
hsl(278deg 93% 25%) 25%,
hsl(284deg 98% 24%) 31%,
hsl(289deg 100% 23%) 37%,
hsl(294deg 100% 23%) 44%,
hsl(299deg 100% 22%) 50%,
hsl(303deg 100% 23%) 56%,
hsl(307deg 100% 24%) 63%,
hsl(311deg 100% 25%) 69%,
hsl(313deg 100% 26%) 75%,
hsl(316deg 95% 28%) 81%,
hsl(320deg 88% 30%) 87%,
hsl(323deg 81% 32%) 94%,
hsl(326deg 75% 33%) 100%
);
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-top: 10px;
cursor: pointer;
border-radius: 5px;
display: block;
margin: 0 auto;
width: 200px;
}
#generate:hover {
background-color: #45a049; /* Hover effect */
}
#resultImage {
border: 2px solid blue;
width: 265px;
height: 300px;
display: flex;
flex-direction: column;
overflow-y: scroll;
margin: auto;
margin-top: 30px;
padding-bottom: 7px;
gap: 14px;
background: linear-gradient(black , black) padding-box,
linear-gradient(to right, red, blue) border-box;
border-radius: 20px;
border: 2.5px solid transparent;
}
#resultContainer img {
max-width: 100%;
height: auto;
display: block;
margin: auto;
}
#loadingSpinner {
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top: 3px solid #ffffff;
width: 20px;
height: 20px;
animation: spin 2s linear infinite;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: none; /* Initially hide the loading spinner */
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="container">
<h1>Aiconvert.online </h1>
<div id="cont">
<input type="text" id="prompt" name="prompt"placeholder="Enter Text Idea">
<br>
</div>
<div>
<button id="generatePrompts" onclick="generatePrompts()">Generate Prompts</button>
</div>
<br>
<div id="cont" style="position: relative;">
<div>
<div id="promptSpinner" class="spinner" style="display: none;"></div>
<input type="text" id="inputs" name="inputs" placeholder="Enter prompt" >
</div>
<br>
</div>
<br>
<button id="showadv" onclick="toggleAdvancedOptions()">Advanced Options</button>
<div id="advanced-options">
<label for="is_negative">Negative prompt :</label>
<input type="text" id="is_negative" name="is_negative" value="blurry, fuzziness">
<br>
<label for="steps">Steps:</label>
<input type="range" id="steps" name="steps" min="30" max="100" value="50">
<span id="steps-value">50</span>
<br>
<label for="cfg_scale">Guidance Scale:</label>
<input type="range" id="cfg_scale" name="cfg_scale" min="1" max="14" value="7.5" step="1">
<span id="cfg-scale-value">7.5</span>
<br>
<label for="seed">Seed:</label>
<input type="range" id="seed" name="seed" min="1" max="99999" value="0" step="1">
<span id="seed-value">0</span>
<br>
<label for="noise_level">Noise Level:</label>
<input type="range" id="noise_level" name="noise_level" min="0" max="10" step="1" value="0">
<span id="noise-level-value">0</span>
<br>
<button onclick="toggleAdvancedOptions()">Hide </button>
</div>
<br>
<div>
<button id="generate" onclick="sendInputs()">generate image </button>
</div>
<div id="resultImage">
<div id="loadingSpinner" style="display: none;"></div>
<div id="resultContainer"></div>
</div>
</div>
</div>
<script>
function showSpinner(spinnerId) {
document.getElementById(spinnerId).style.display = 'block';
}
function hideSpinner(spinnerId) {
document.getElementById(spinnerId).style.display = 'none';
}
function generatePrompts() {
showSpinner('promptSpinner');
const prompt = document.getElementById("prompt").value;
fetch(`/generate_prompts?prompt_text=${encodeURIComponent(prompt)}`)
.then(response => response.text())
.then(data => {
document.getElementById("inputs").value = data.trim();
hideSpinner('promptSpinner');
})
.catch(error => {
console.error('Error:', error);
hideSpinner('promptSpinner');
});
}
async function sendInputs() {
const inputs = document.getElementById("inputs").value;
const noiseLevel = document.getElementById("noise_level").value;
const isNegative = document.getElementById("is_negative").value;
const steps = document.getElementById("steps").value;
const cfgScale = document.getElementById("cfg_scale").value;
const seed = document.getElementById("seed").value;
// Check if the input field is empty
if (!inputs) {
document.getElementById('resultContainer').innerHTML = `<p style="color: white;">Please enter a prompt before sending.</p>`;
return;
}
// Clear the result container
document.getElementById('resultContainer').innerHTML = "";
// Display loading spinner
const loadingSpinner = document.getElementById('loadingSpinner');
loadingSpinner.style.display = 'block';
try {
// Fetch data from the server
const response = await fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}&is_negative=${isNegative}&steps=${steps}&cfg_scale=${cfgScale}&seed=${seed}`);
// Check if the response is successful
if (response.ok) {
const resultContainer = document.getElementById('resultContainer');
const data = await response.json();
const img = document.createElement('img');
img.style.maxWidth = '100%'; // Adjust this value as needed
img.style.maxHeight = '100%'; // Adjust this value as needed
img.src = 'data:image/jpeg;base64,' + data.image_base64;
resultContainer.appendChild(img);
} else {
document.getElementById('resultContainer').innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
}
} catch (error) {
console.error('Error:', error);
document.getElementById('resultContainer').innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
} finally {
// Hide loading spinner regardless of success or failure
const loadingSpinner = document.getElementById('loadingSpinner');
loadingSpinner.style.display = 'none';
}
}
function toggleAdvancedOptions() {
const advancedOptions = document.getElementById("advanced-options");
if (advancedOptions.style.display === "none") {
advancedOptions.style.display = "block";
} else {
advancedOptions.style.display = "none";
}
}
// Function to update slider value display
function updateSliderValue(sliderId, spanId) {
const slider = document.getElementById(sliderId);
const span = document.getElementById(spanId);
span.textContent = slider.value;
}
// Event listeners to update slider values
document.getElementById("steps").addEventListener("input", () => {
updateSliderValue("steps", "steps-value");
});
document.getElementById("cfg_scale").addEventListener("input", () => {
updateSliderValue("cfg_scale", "cfg-scale-value");
});
document.getElementById("seed").addEventListener("input", () => {
updateSliderValue("seed", "seed-value");
});
document.getElementById("noise_level").addEventListener("input", () => {
updateSliderValue("noise_level", "noise-level-value");
});
</script>
</body>
</html>
|