adminuser742150 commited on
Commit
de4a1e3
·
verified ·
1 Parent(s): 0aee795

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +128 -74
index.html CHANGED
@@ -1,77 +1,131 @@
1
-
2
  <!DOCTYPE html>
3
  <html lang="en">
4
- <head>
5
- <meta charset="utf-8" />
6
- <meta
7
- name="viewport"
8
- content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1"
9
- />
10
-
11
- <script>
12
- window.__gradio_mode__ = "app";
13
- window.gradio_config = {"version": "3.0.26\n", "mode": "blocks", "dev_mode": false, "components": [{"id": 1, "type": "column", "props": {"type": "column", "variant": "default", "visible": true, "style": {}}}, {"id": 2, "type": "markdown", "props": {"value": "<h1><center>DALL\u00b7E mini by <a href=\"https://www.craiyon.com/\" target=\"_blank\">craiyon.com</a></center></h1>", "name": "markdown", "visible": true, "style": {}}}, {"id": 3, "type": "markdown", "props": {"value": "<center>AI model generating images from any prompt!</center>", "name": "markdown", "visible": true, "style": {}}}, {"id": 4, "type": "group", "props": {"type": "group", "visible": true, "style": {}}}, {"id": 5, "type": "box", "props": {"type": "box", "visible": true, "style": {}}}, {"id": 6, "type": "row", "props": {"type": "row", "visible": true, "style": {"equal_height": true, "mobile_collapse": false}}}, {"id": 7, "type": "textbox", "props": {"lines": 1, "max_lines": 1, "value": "", "label": "Enter your prompt", "show_label": false, "name": "textbox", "visible": true, "elem_id": "prompt", "style": {"container": false}}}, {"id": 8, "type": "button", "props": {"value": "Run", "variant": "primary", "name": "button", "visible": true, "style": {}}}, {"id": 9, "type": "gallery", "props": {"value": [], "label": "Generated images", "show_label": false, "name": "gallery", "visible": true, "elem_id": "gallery", "style": {"grid": [3], "height": "auto"}}}, {"id": 10, "type": "column", "props": {"type": "column", "variant": "default", "visible": true, "style": {}}}, {"id": 11, "type": "button", "props": {"value": "Screenshot", "variant": "secondary", "name": "button", "visible": true, "elem_id": "screenshot", "style": {"full_width": true}}}, {"id": 12, "type": "markdown", "props": {"value": "<details>\n<summary>Bias and Limitations</summary>\n<p style='line-height: normal; font-size: small'>\nWhile the capabilities of image generation models are impressive, they may also reinforce or exacerbate societal biases. While the extent and nature of the biases of the DALL\u00b7E mini model have yet to be fully documented, given the fact that the model was trained on unfiltered data from the Internet, it may generate images that contain stereotypes against minority groups. Work to analyze the nature and extent of these limitations is ongoing, and will be documented in more detail in the <a href=\"https://huggingface.co/dalle-mini/dalle-mini\" target=\"_blank\">DALL\u00b7E mini model card</a>.\n</p>\n</details>", "name": "markdown", "visible": true, "style": {}}}, {"id": 13, "type": "markdown", "props": {"value": "<p style='text-align: center'>\nDALL\u00b7E mini is migrating to \ud83d\udd8d\ufe0f <a href=\"https://www.craiyon.com/\" target=\"_blank\">craiyon.com</a>\n</p>", "name": "markdown", "visible": true, "style": {}}}, {"id": 14, "type": "markdown", "props": {"value": "<hr />\n<p style='text-align: center'>\nCreated by <a href=\"https://twitter.com/borisdayma\" target=\"_blank\">Boris Dayma</a> et al. 2021-2022\n<br/>\n<a href=\"https://github.com/borisdayma/dalle-mini\" target=\"_blank\">GitHub</a> | <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>\n<p style='text-align: center'>Powered by Google <a href=\"https://sites.research.google/trc/\" target=\"_blank\">TPU Research Cloud</a>\n</p>", "name": "markdown", "visible": true, "style": {}}}], "theme": "default", "css": ".container { max-width: 800px; margin: auto; }", "title": "Gradio", "enable_queue": false, "layout": {"id": 0, "children": [{"id": 1, "children": [{"id": 2}, {"id": 3}, {"id": 4, "children": [{"id": 5, "children": [{"id": 6, "children": [{"id": 7}, {"id": 8}]}]}, {"id": 9}]}]}, {"id": 10, "children": [{"id": 11}, {"id": 12}, {"id": 13}, {"id": 14}]}]}, "dependencies": [{"targets": [8], "trigger": "click", "inputs": [7], "outputs": [9], "backend_fn": false, "js": "\n async (text) => {\n try {\n document.querySelector('#screenshot').style.display = 'none';\n response = await fetch('https://bf.dallemini.ai/generate', {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n prompt: text\n })\n });\n response = await response.json()\n let imgs = response.images.map(r => \"data:image/png;base64,\" + r)\n document.querySelector('#screenshot').style.display = 'block';\n return imgs\n } catch (e) {\n alert(\"Too much traffic, please try again.\")\n IMG = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAOVBMVEXg4OB1dXXX19fd3d2EhIR9fX14eHjJycm2trbb29uurq6goKCZmZmIiIiBgYHNzc2np6e8vLySkpKXK8HrAAABuUlEQVR4nO3Z0bKCIBCAYQNFVCzr/R/2nHU6k8KpJi6wZf7vLu1id9gFhKYBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAb249h7pzr5jD29uhospnlfNo4L+boiLKYyZ0iblKYiu/iNER3PTquD9npPgbB98Za0/twH59JVasMtzXo1m+iHny7PrwpysSuebgxCtmOTlkma121l/TFZR2UqXxEebxEO/87QZlZ3inpeCPzVftkojUyJp2OWVgKy23qSsbg8evitBSXkUjHzYN9Is0oeWoYkkUKazsxRYlYKa6ldFSfs7K/8tsnUSLrXHAuG1SOXpp5t1LEiQxSe33ZqDJIC4TdkziRJkRN9J1CXFlpIj7J9RvNSd0kiUj1zSVjyiKr4X5yTRIx0kYlY8oinbzfFSaJWFlJSsaUpZpEqimttNkTOpo9nX4TOqbfdEFM6FgQpW7c8OofSrYo1Wwaq9nG1/NhVc2nbj2HD821kuOgeg7o3hyZBj1Hpo9D7M3K+HeIrSmPeq4Vfl3ruOhpnly9vdyEfa1KLkPF7nr66GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPjcD13rCcC3ILx/AAAAAElFTkSuQmCC\"\n document.querySelector('#screenshot').style.display = 'block';\n return Array(9).fill(IMG)\n }\n }\n ", "status_tracker": null, "queue": null, "api_name": null, "scroll_to_output": false, "show_progress": true}, {"targets": [11], "trigger": "click", "inputs": [], "outputs": [], "backend_fn": false, "js": "\n () => {\n const captureElement = document.getElementById(1)\n let bg_color = getComputedStyle(document.querySelector(\"#root .container\"))[\"background-color\"]\n captureElement.style.backgroundColor = bg_color; \n html2canvas(captureElement)\n .then(canvas => {\n canvas.style.display = 'none'\n document.body.appendChild(canvas)\n return canvas\n })\n .then(canvas => {\n const image = canvas.toDataURL('image/png').replace('image/png', 'image/octet-stream')\n const a = document.createElement('a')\n const date = new Date()\n const filename = `dallemini_${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}_${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}.png`\n a.setAttribute('download', filename)\n a.setAttribute('href', image)\n a.click()\n canvas.remove()\n })\n }\n ", "status_tracker": null, "queue": null, "api_name": null, "scroll_to_output": false, "show_progress": true}]};
14
- </script>
15
-
16
- <link rel="preconnect" href="https://fonts.googleapis.com" />
17
- <link
18
- rel="preconnect"
19
- href="https://fonts.gstatic.com"
20
- crossorigin="anonymous"
21
- />
22
- <link
23
- href="https://fonts.googleapis.com/css?family=Source Sans Pro"
24
- rel="stylesheet"
25
- />
26
- <link
27
- href="https://fonts.googleapis.com/css?family=IBM Plex Mono"
28
- rel="stylesheet"
29
- />
30
- <script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
31
- <script type="module" crossorigin src="https://gradio.s3-us-west-2.amazonaws.com/3.0.9b12/assets/index.8eca4ae7.js"></script>
32
- <link rel="stylesheet" href="https://gradio.s3-us-west-2.amazonaws.com/3.0.9b12/assets/index.cbea297d.css">
33
- <style>
34
- #screenshot {
35
- display: none;
36
- }
37
- .container > div > div {
38
- padding: 0.5rem;
39
- }
40
- footer a {
41
- color: rgb(156 163 175) !important;
42
- }
43
- footer img {
44
- display: none !important;
45
- }
46
- </style>
47
- <style id="mofo">
48
- body {
49
- display: none !important;
50
- }
51
- </style>
52
- <script type="text/javascript">
53
- if (self === top || window.location.ancestorOrigins[0] === "https://huggingface.co") {
54
- var mofo = document.getElementById("mofo");
55
- mofo.parentNode.removeChild(mofo);
56
- } else {
57
- top.location = self.location;
58
- }
59
- </script>
60
- </head>
61
-
62
- <body
63
- style="
64
- margin: 0;
65
- padding: 0;
66
- display: flex;
67
- flex-direction: column;
68
- flex-grow: 1;
69
- "
70
- >
71
- <div
72
- id="root"
73
- style="display: flex; flex-direction: column; flex-grow: 1"
74
- ></div>
75
- <script src="html2canvas.js"></script>
76
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>