Spaces:
Running
Running
Update index.html
Browse files- index.html +128 -74
index.html
CHANGED
|
@@ -1,77 +1,131 @@
|
|
| 1 |
-
|
| 2 |
<!DOCTYPE html>
|
| 3 |
<html lang="en">
|
| 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 |
</html>
|
|
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
| 6 |
+
<title>DALL·E Mini by Craiyon</title>
|
| 7 |
+
|
| 8 |
+
<!-- Fonts -->
|
| 9 |
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
| 10 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
| 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 |
+
font-family: "Source Sans Pro", sans-serif;
|
| 18 |
+
background: #f5f5f5;
|
| 19 |
+
}
|
| 20 |
+
.container {
|
| 21 |
+
max-width: 800px;
|
| 22 |
+
margin: auto;
|
| 23 |
+
padding: 20px;
|
| 24 |
+
}
|
| 25 |
+
h1, h2, p, center {
|
| 26 |
+
text-align: center;
|
| 27 |
+
}
|
| 28 |
+
#screenshot {
|
| 29 |
+
display: none;
|
| 30 |
+
margin: 10px auto;
|
| 31 |
+
padding: 10px;
|
| 32 |
+
width: 100%;
|
| 33 |
+
max-width: 200px;
|
| 34 |
+
}
|
| 35 |
+
footer a {
|
| 36 |
+
color: #999 !important;
|
| 37 |
+
}
|
| 38 |
+
footer img {
|
| 39 |
+
display: none !important;
|
| 40 |
+
}
|
| 41 |
+
</style>
|
| 42 |
+
|
| 43 |
+
<!-- Gradio App Configuration -->
|
| 44 |
+
<script>
|
| 45 |
+
window.__gradio_mode__ = "app";
|
| 46 |
+
</script>
|
| 47 |
+
|
| 48 |
+
<!-- Load Gradio v3 App -->
|
| 49 |
+
<script type="module" crossorigin src="https://gradio.s3-us-west-2.amazonaws.com/3.0.26/assets/index.8eca4ae7.js"></script>
|
| 50 |
+
<link rel="stylesheet" href="https://gradio.s3-us-west-2.amazonaws.com/3.0.26/assets/index.cbea297d.css" />
|
| 51 |
+
|
| 52 |
+
<!-- html2canvas for screenshots -->
|
| 53 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" integrity="sha512-BNaPnfnzQ07hMPYIMz3EqzSc1VVm4ZzCDMQtXwOPlJKHnp4h7CMqvoSCk1QnXClQvUOJwSv6+FLpRSl5Is3gDA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
| 54 |
+
</head>
|
| 55 |
+
|
| 56 |
+
<body>
|
| 57 |
+
<div id="root" class="container">
|
| 58 |
+
<h1>DALL·E mini by <a href="https://www.craiyon.com/" target="_blank">craiyon.com</a></h1>
|
| 59 |
+
<p>AI model generating images from any prompt!</p>
|
| 60 |
+
|
| 61 |
+
<div style="display: flex; gap: 10px; justify-content: center; margin-top: 20px;">
|
| 62 |
+
<input id="prompt" type="text" placeholder="Enter your prompt" style="width: 60%;" />
|
| 63 |
+
<button onclick="runPrompt()">Run</button>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<div id="gallery" style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px;"></div>
|
| 67 |
+
|
| 68 |
+
<button id="screenshot" onclick="captureScreenshot()">Download Screenshot</button>
|
| 69 |
+
|
| 70 |
+
<details style="margin-top: 30px;">
|
| 71 |
+
<summary><strong>Bias and Limitations</strong></summary>
|
| 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 button = document.getElementById("screenshot");
|
| 93 |
+
button.style.display = "none";
|
| 94 |
+
gallery.innerHTML = "Loading...";
|
| 95 |
+
|
| 96 |
+
try {
|
| 97 |
+
const res = await fetch("https://bf.dallemini.ai/generate", {
|
| 98 |
+
method: "POST",
|
| 99 |
+
headers: { "Content-Type": "application/json" },
|
| 100 |
+
body: JSON.stringify({ prompt })
|
| 101 |
+
});
|
| 102 |
+
|
| 103 |
+
const data = await res.json();
|
| 104 |
+
const images = data.images || [];
|
| 105 |
+
|
| 106 |
+
gallery.innerHTML = images.map(img =>
|
| 107 |
+
`<img src="data:image/png;base64,${img}" style="width: 100%;" />`
|
| 108 |
+
).join("");
|
| 109 |
+
|
| 110 |
+
button.style.display = "block";
|
| 111 |
+
} catch (err) {
|
| 112 |
+
alert("Too much traffic or error. Try again later.");
|
| 113 |
+
gallery.innerHTML = "Failed to generate images.";
|
| 114 |
+
button.style.display = "none";
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
function captureScreenshot() {
|
| 119 |
+
html2canvas(document.getElementById("gallery")).then(canvas => {
|
| 120 |
+
const image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
|
| 121 |
+
const a = document.createElement("a");
|
| 122 |
+
const now = new Date();
|
| 123 |
+
const filename = `dallemini_${now.toISOString().replace(/[:T]/g, "-").split(".")[0]}.png`;
|
| 124 |
+
a.setAttribute("download", filename);
|
| 125 |
+
a.setAttribute("href", image);
|
| 126 |
+
a.click();
|
| 127 |
+
});
|
| 128 |
+
}
|
| 129 |
+
</script>
|
| 130 |
+
</body>
|
| 131 |
</html>
|