Spaces:
Sleeping
Sleeping
Delete templates/imagine.html
Browse files- templates/imagine.html +0 -147
templates/imagine.html
DELETED
|
@@ -1,147 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
|
| 4 |
-
<head>
|
| 5 |
-
<meta charset="UTF-8">
|
| 6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>Imagine | TaskBot v1+ AI</title>
|
| 8 |
-
</head>
|
| 9 |
-
|
| 10 |
-
<style>
|
| 11 |
-
body {
|
| 12 |
-
background-color: #2f2f2f;
|
| 13 |
-
font-family: Arial, sans-serif;
|
| 14 |
-
color: white;
|
| 15 |
-
margin: 0;
|
| 16 |
-
padding: 20px;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
input {
|
| 20 |
-
width: 100%;
|
| 21 |
-
height: 26px;
|
| 22 |
-
border-radius: 50px;
|
| 23 |
-
text-align: center;
|
| 24 |
-
justify-content: center;
|
| 25 |
-
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
#image {
|
| 29 |
-
text-align: center;
|
| 30 |
-
border: 1px solid white;
|
| 31 |
-
padding: 10px;
|
| 32 |
-
margin: 20px auto;
|
| 33 |
-
height: 400px;
|
| 34 |
-
width: 400px;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
#inputWrapper {
|
| 38 |
-
text-align: center;
|
| 39 |
-
margin: 20px auto;
|
| 40 |
-
bottom: 20px;
|
| 41 |
-
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
button {
|
| 45 |
-
background-color: black;
|
| 46 |
-
color: greenyellow;
|
| 47 |
-
height: 50px
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
@media (max-width: 768px) {
|
| 51 |
-
#image {
|
| 52 |
-
width: 300px;
|
| 53 |
-
height: 300px;
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
input {
|
| 57 |
-
width: 80%;
|
| 58 |
-
}
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
small {
|
| 62 |
-
color: gray;
|
| 63 |
-
text-align: center;
|
| 64 |
-
display: block;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
h1 {
|
| 68 |
-
text-align: center;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
@keyframes color-change {
|
| 72 |
-
0% {
|
| 73 |
-
background-color: red;
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
20% {
|
| 77 |
-
background-color: blue;
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
40% {
|
| 81 |
-
background-color: rgb(0, 255, 0);
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
60% {
|
| 85 |
-
background-color: aqua;
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
80% {
|
| 89 |
-
background-color: yellow;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
100% {
|
| 93 |
-
background-color: red;
|
| 94 |
-
}
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
.color_change {
|
| 98 |
-
animation: color-change 4s infinite;
|
| 99 |
-
}
|
| 100 |
-
</style>
|
| 101 |
-
|
| 102 |
-
<div>
|
| 103 |
-
<h1>Image Generator</h1><br>
|
| 104 |
-
<small>Powered by gemini-2.0-flash-preview-image-generation</small><br><br>
|
| 105 |
-
<br>
|
| 106 |
-
<div id="image">
|
| 107 |
-
<img src="" id="generated_image" style="max-width: 400px;" alt="Generated Image"><br><br><br>
|
| 108 |
-
</div>
|
| 109 |
-
<div id="inputWrapper">
|
| 110 |
-
<input type="text" id="contents" placeholder="Enter your prompt..."><br><br><br>
|
| 111 |
-
<button onclick="generate()" id="generate_button">Generate Image</button>
|
| 112 |
-
</div>
|
| 113 |
-
</body>
|
| 114 |
-
<script>
|
| 115 |
-
async function generate() {
|
| 116 |
-
document.getElementById("generate_button").disabled = true
|
| 117 |
-
document.getElementById("image").classList.add("color_change");
|
| 118 |
-
document.getElementById("image").src = "";
|
| 119 |
-
const contents = document.getElementById("contents").value;
|
| 120 |
-
const response = await fetch("/imagine", {
|
| 121 |
-
method: "POST",
|
| 122 |
-
headers: {
|
| 123 |
-
"Content-Type": "application/x-www-form-urlencoded"
|
| 124 |
-
},
|
| 125 |
-
body: new URLSearchParams({ contents })
|
| 126 |
-
});
|
| 127 |
-
|
| 128 |
-
if (response.ok) {
|
| 129 |
-
const blob = await response.blob();
|
| 130 |
-
const imgUrl = URL.createObjectURL(blob);
|
| 131 |
-
document.getElementById("generated_image").src = imgUrl;
|
| 132 |
-
document.getElementById("image").classList.remove("color_change")
|
| 133 |
-
document.getElementById("image").style.border = "none";
|
| 134 |
-
document.getElementById("generate_button").disabled = false
|
| 135 |
-
} else {
|
| 136 |
-
console.error("Error generating image:", response.statusText);
|
| 137 |
-
}
|
| 138 |
-
}
|
| 139 |
-
document.getElementById("contents").addEventListener("keypress", (event) => {
|
| 140 |
-
if (event.key === "Enter") {
|
| 141 |
-
generate()
|
| 142 |
-
}
|
| 143 |
-
})
|
| 144 |
-
|
| 145 |
-
</script>
|
| 146 |
-
|
| 147 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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