Spaces:
Running
Running
Update index.html
Browse files- index.html +139 -67
index.html
CHANGED
|
@@ -2,96 +2,166 @@
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1
|
| 6 |
-
<title>DALL·E Mini
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro|IBM+Plex+Mono&display=swap" rel="stylesheet" />
|
| 12 |
|
| 13 |
-
<!-- Styles -->
|
| 14 |
-
<style>
|
| 15 |
body {
|
| 16 |
margin: 0;
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
}
|
|
|
|
| 20 |
.container {
|
| 21 |
-
max-width:
|
| 22 |
margin: auto;
|
| 23 |
-
padding:
|
| 24 |
}
|
| 25 |
-
|
|
|
|
| 26 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
|
|
|
| 28 |
#screenshot {
|
| 29 |
display: none;
|
| 30 |
-
margin:
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
max-width: 200px;
|
| 34 |
}
|
| 35 |
-
|
| 36 |
-
|
|
|
|
| 37 |
}
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
| 41 |
-
</style>
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
</head>
|
| 55 |
-
|
| 56 |
<body>
|
| 57 |
-
<div
|
| 58 |
-
<h1>DALL·E
|
| 59 |
-
<p>
|
| 60 |
|
| 61 |
-
<div
|
| 62 |
-
<input id="prompt" type="text" placeholder="
|
| 63 |
-
<button onclick="runPrompt()">
|
| 64 |
</div>
|
| 65 |
|
| 66 |
-
<div id="gallery"
|
|
|
|
| 67 |
|
| 68 |
<button id="screenshot" onclick="captureScreenshot()">Download Screenshot</button>
|
| 69 |
|
| 70 |
-
<
|
| 71 |
-
<
|
| 72 |
-
<p style="font-size: small;">
|
| 73 |
-
While the capabilities of image generation models are impressive, they may also reinforce or exacerbate societal biases. Learn more in the
|
| 74 |
-
<a href="https://huggingface.co/dalle-mini/dalle-mini" target="_blank">model card</a>.
|
| 75 |
-
</p>
|
| 76 |
-
</details>
|
| 77 |
-
|
| 78 |
-
<p>DALL·E mini is migrating to 🖍️ <a href="https://www.craiyon.com/" target="_blank">craiyon.com</a></p>
|
| 79 |
-
|
| 80 |
-
<footer style="margin-top: 20px; text-align: center;">
|
| 81 |
-
Created by <a href="https://twitter.com/borisdayma" target="_blank">Boris Dayma</a> et al. (2021-2022) <br />
|
| 82 |
-
<a href="https://github.com/borisdayma/dalle-mini" target="_blank">GitHub</a> |
|
| 83 |
-
<a href="https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini-Generate-images-from-any-text-prompt--VmlldzoyMDE4NDAy" target="_blank">Project Report</a> <br />
|
| 84 |
-
Powered by Google <a href="https://sites.research.google/trc/" target="_blank">TPU Research Cloud</a>
|
| 85 |
</footer>
|
| 86 |
</div>
|
| 87 |
|
| 88 |
<script>
|
| 89 |
async function runPrompt() {
|
| 90 |
-
const prompt = document.getElementById("prompt").value;
|
| 91 |
const gallery = document.getElementById("gallery");
|
| 92 |
-
const
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
try {
|
| 97 |
const res = await fetch("https://bf.dallemini.ai/generate", {
|
|
@@ -103,15 +173,17 @@
|
|
| 103 |
const data = await res.json();
|
| 104 |
const images = data.images || [];
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
| 115 |
}
|
| 116 |
}
|
| 117 |
|
|
|
|
| 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>DALL·E Mini Modern UI</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet" />
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--bg-color: #121212;
|
| 12 |
+
--card-color: #1e1e1e;
|
| 13 |
+
--text-color: #f0f0f0;
|
| 14 |
+
--accent-color: #4ade80;
|
| 15 |
+
}
|
| 16 |
|
| 17 |
+
* {
|
| 18 |
+
box-sizing: border-box;
|
| 19 |
+
}
|
|
|
|
| 20 |
|
|
|
|
|
|
|
| 21 |
body {
|
| 22 |
margin: 0;
|
| 23 |
+
background: var(--bg-color);
|
| 24 |
+
color: var(--text-color);
|
| 25 |
+
font-family: 'Inter', sans-serif;
|
| 26 |
}
|
| 27 |
+
|
| 28 |
.container {
|
| 29 |
+
max-width: 960px;
|
| 30 |
margin: auto;
|
| 31 |
+
padding: 2rem;
|
| 32 |
}
|
| 33 |
+
|
| 34 |
+
h1 {
|
| 35 |
text-align: center;
|
| 36 |
+
font-size: 2rem;
|
| 37 |
+
margin-bottom: 0.5rem;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
p {
|
| 41 |
+
text-align: center;
|
| 42 |
+
font-size: 1rem;
|
| 43 |
+
color: #ccc;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.input-area {
|
| 47 |
+
display: flex;
|
| 48 |
+
flex-direction: column;
|
| 49 |
+
gap: 1rem;
|
| 50 |
+
margin: 2rem 0;
|
| 51 |
+
align-items: center;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
input[type="text"] {
|
| 55 |
+
padding: 0.8rem 1rem;
|
| 56 |
+
border: none;
|
| 57 |
+
border-radius: 8px;
|
| 58 |
+
width: 100%;
|
| 59 |
+
max-width: 600px;
|
| 60 |
+
font-size: 1rem;
|
| 61 |
+
background: #2a2a2a;
|
| 62 |
+
color: var(--text-color);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
button {
|
| 66 |
+
padding: 0.8rem 1.5rem;
|
| 67 |
+
background: var(--accent-color);
|
| 68 |
+
border: none;
|
| 69 |
+
border-radius: 8px;
|
| 70 |
+
font-weight: 600;
|
| 71 |
+
color: #000;
|
| 72 |
+
cursor: pointer;
|
| 73 |
+
transition: 0.3s ease;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
button:hover {
|
| 77 |
+
background: #22c55e;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
#gallery {
|
| 81 |
+
display: grid;
|
| 82 |
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
| 83 |
+
gap: 1rem;
|
| 84 |
+
margin-top: 2rem;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
#gallery img {
|
| 88 |
+
width: 100%;
|
| 89 |
+
border-radius: 10px;
|
| 90 |
+
object-fit: cover;
|
| 91 |
}
|
| 92 |
+
|
| 93 |
#screenshot {
|
| 94 |
display: none;
|
| 95 |
+
margin: 2rem auto;
|
| 96 |
+
background: #3b82f6;
|
| 97 |
+
color: white;
|
|
|
|
| 98 |
}
|
| 99 |
+
|
| 100 |
+
#screenshot:hover {
|
| 101 |
+
background: #2563eb;
|
| 102 |
}
|
| 103 |
+
|
| 104 |
+
.loader {
|
| 105 |
+
text-align: center;
|
| 106 |
+
font-size: 1rem;
|
| 107 |
+
color: #999;
|
| 108 |
+
margin-top: 2rem;
|
| 109 |
}
|
|
|
|
| 110 |
|
| 111 |
+
footer {
|
| 112 |
+
margin-top: 3rem;
|
| 113 |
+
text-align: center;
|
| 114 |
+
font-size: 0.85rem;
|
| 115 |
+
color: #888;
|
| 116 |
+
}
|
| 117 |
|
| 118 |
+
a {
|
| 119 |
+
color: var(--accent-color);
|
| 120 |
+
text-decoration: none;
|
| 121 |
+
}
|
| 122 |
|
| 123 |
+
@media (max-width: 500px) {
|
| 124 |
+
input[type="text"] {
|
| 125 |
+
width: 90%;
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
</style>
|
| 129 |
</head>
|
|
|
|
| 130 |
<body>
|
| 131 |
+
<div class="container">
|
| 132 |
+
<h1>DALL·E Mini by <a href="https://www.craiyon.com/" target="_blank">Craiyon</a></h1>
|
| 133 |
+
<p>Type your prompt and generate AI images in seconds</p>
|
| 134 |
|
| 135 |
+
<div class="input-area">
|
| 136 |
+
<input id="prompt" type="text" placeholder="E.g. futuristic city made of candy" />
|
| 137 |
+
<button onclick="runPrompt()">Generate Images</button>
|
| 138 |
</div>
|
| 139 |
|
| 140 |
+
<div id="gallery"></div>
|
| 141 |
+
<div class="loader" id="loader"></div>
|
| 142 |
|
| 143 |
<button id="screenshot" onclick="captureScreenshot()">Download Screenshot</button>
|
| 144 |
|
| 145 |
+
<footer>
|
| 146 |
+
Made by <a href="https://twitter.com/borisdayma" target="_blank">Boris Dayma</a> • Powered by <a href="https://www.craiyon.com/" target="_blank">Craiyon</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
</footer>
|
| 148 |
</div>
|
| 149 |
|
| 150 |
<script>
|
| 151 |
async function runPrompt() {
|
| 152 |
+
const prompt = document.getElementById("prompt").value.trim();
|
| 153 |
const gallery = document.getElementById("gallery");
|
| 154 |
+
const loader = document.getElementById("loader");
|
| 155 |
+
const screenshotBtn = document.getElementById("screenshot");
|
| 156 |
+
|
| 157 |
+
gallery.innerHTML = "";
|
| 158 |
+
loader.textContent = "Generating images... Please wait.";
|
| 159 |
+
screenshotBtn.style.display = "none";
|
| 160 |
+
|
| 161 |
+
if (!prompt) {
|
| 162 |
+
loader.textContent = "Please enter a prompt.";
|
| 163 |
+
return;
|
| 164 |
+
}
|
| 165 |
|
| 166 |
try {
|
| 167 |
const res = await fetch("https://bf.dallemini.ai/generate", {
|
|
|
|
| 173 |
const data = await res.json();
|
| 174 |
const images = data.images || [];
|
| 175 |
|
| 176 |
+
if (images.length > 0) {
|
| 177 |
+
gallery.innerHTML = images.map(img =>
|
| 178 |
+
`<img src="data:image/png;base64,${img}" alt="Generated Image" />`
|
| 179 |
+
).join("");
|
| 180 |
+
screenshotBtn.style.display = "block";
|
| 181 |
+
loader.textContent = "";
|
| 182 |
+
} else {
|
| 183 |
+
loader.textContent = "No images returned. Try a different prompt.";
|
| 184 |
+
}
|
| 185 |
+
} catch (error) {
|
| 186 |
+
loader.textContent = "Error: Server busy or unreachable. Try again later.";
|
| 187 |
}
|
| 188 |
}
|
| 189 |
|