|
<!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 { |
|
background-color: #030303; |
|
padding: 0px; |
|
border-radius: 12px; |
|
box-shadow: 8px 8px 16px #050505, -8px -8px 16px #080808; |
|
display: flex; |
|
align-items: center; |
|
border: 2px solid rgb(247, 6, 187); |
|
} |
|
#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; |
|
} |
|
#cont button { |
|
padding: 2.5vh 4.6vh; |
|
margin: 1vh; |
|
background: linear-gradient(145deg, rgb(0, 149, 249), #ff0095, rgb(255, 0, 43)); |
|
border: none; |
|
border-radius: 8px; |
|
color: #fff; |
|
cursor: pointer; |
|
} |
|
#cont button:hover { |
|
background: linear-gradient(145deg, #00ffab, #4e00f9, rgb(255, 0, 43)); |
|
} |
|
.container { |
|
text-align: center; |
|
} |
|
|
|
h1 { |
|
margin-bottom: 20px; |
|
font-family: 'Barlow Condensed'; |
|
color: pink; |
|
} |
|
#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; |
|
} |
|
|
|
|
|
.image-container { |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
flex-wrap: wrap; |
|
gap: 10px; |
|
} |
|
|
|
.image-box { |
|
width: 200px; |
|
height: 200px; |
|
border: 2px solid #ffffff; |
|
border-radius: 10px; |
|
overflow: hidden; |
|
position: relative; |
|
} |
|
|
|
.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); } |
|
} |
|
|
|
.image-box img { |
|
position: absolute; |
|
top: 0; |
|
left: 0; |
|
width: 100%; |
|
height: 100%; |
|
object-fit: cover; |
|
} |
|
|
|
|
|
|
|
#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; |
|
} |
|
#image-box { |
|
border: 2px solid blue; |
|
width: 330px; |
|
height: 330px; |
|
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; |
|
} |
|
|
|
#image-box p { |
|
width: 80%; |
|
font-size: 20px; |
|
color: white; |
|
} |
|
|
|
</style> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
<h1>Aiconvert.online </h1> |
|
<div id="cont"> |
|
<div> |
|
<label for="prompt">Enter text:</label> |
|
<input type="text" id="prompt" name="prompt"> |
|
</div> |
|
<br> |
|
<div> |
|
<button onclick="generatePrompts()">Generate Prompts</button> |
|
<div id="promptSpinner" class="spinner" style="display: none;"></div> |
|
</div> |
|
</div> |
|
<br> |
|
<div id="cont"> |
|
<div> |
|
<label for="inputs">Enter inputs:</label> |
|
<input type="text" id="inputs" name="inputs"> |
|
<label for="noise_level">Noise Level:</label> |
|
<input type="number" id="noise_level" name="noise_level" step="0.01" min="0" max="1" value="0"> |
|
</div> |
|
<br> |
|
<div> |
|
<button onclick="sendInputs()">Send Inputs</button> |
|
<div id="sendSpinner" class="spinner" style="display: none;"></div> |
|
</div> |
|
</div> |
|
|
|
<br> |
|
<div id="output-container" class="image-container"> |
|
<div id="image-box" class="image-box"> |
|
<p>Your Generated Arts Will Appear Here</p> |
|
</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'); |
|
}); |
|
} |
|
|
|
function sendInputs() { |
|
showSpinner('sendSpinner'); |
|
const inputs = document.getElementById("inputs").value; |
|
const noiseLevel = document.getElementById("noise_level").value; |
|
fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}`) |
|
.then(response => response.json()) |
|
.then(data => { |
|
const imageBox = document.getElementById("image-box"); |
|
const img = new Image(); |
|
img.src = 'data:image/jpeg;base64,' + data.image_base64; |
|
const maxWidth = 200; |
|
const maxHeight = 200; |
|
if (img.width > maxWidth || img.height > maxHeight) { |
|
const ratio = Math.min(maxWidth / img.width, maxHeight / img.height); |
|
img.width *= ratio; |
|
img.height *= ratio; |
|
} |
|
imageBox.appendChild(img); |
|
hideSpinner('sendSpinner'); |
|
}) |
|
.catch(error => { |
|
console.error('Error:', error); |
|
hideSpinner('sendSpinner'); |
|
}); |
|
} |
|
</script> |
|
</body> |
|
</html> |
|
|