adminuser742150 commited on
Commit
441b2d9
·
verified ·
1 Parent(s): 6d02578

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +74 -168
index.html CHANGED
@@ -1,170 +1,76 @@
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.0"/>
6
- <title>AI Image Generator</title>
7
- <style>
8
- body {
9
- font-family: 'Segoe UI', sans-serif;
10
- background: #f9f9f9;
11
- margin: 0;
12
- padding: 20px;
13
- color: #333;
14
- }
15
- h1 {
16
- text-align: center;
17
- margin-bottom: 20px;
18
- }
19
- .container {
20
- max-width: 960px;
21
- margin: auto;
22
- padding: 20px;
23
- background: white;
24
- border-radius: 10px;
25
- box-shadow: 0 0 20px rgba(0,0,0,0.1);
26
- }
27
- label {
28
- display: block;
29
- margin-top: 10px;
30
- font-weight: 500;
31
- }
32
- input[type="text"], select, textarea {
33
- width: 100%;
34
- padding: 10px;
35
- margin-top: 5px;
36
- border: 1px solid #ccc;
37
- border-radius: 6px;
38
- }
39
- input[type="range"] {
40
- width: 100%;
41
- }
42
- button {
43
- background: #007bff;
44
- color: white;
45
- border: none;
46
- padding: 12px 20px;
47
- border-radius: 6px;
48
- cursor: pointer;
49
- font-size: 16px;
50
- margin-top: 20px;
51
- }
52
- button:hover {
53
- background: #0056b3;
54
- }
55
- .image-grid {
56
- display: flex;
57
- flex-wrap: wrap;
58
- gap: 15px;
59
- margin-top: 20px;
60
- }
61
- .image-grid a {
62
- display: inline-block;
63
- width: 100%;
64
- max-width: 300px;
65
- overflow: hidden;
66
- border-radius: 8px;
67
- box-shadow: 0 0 10px rgba(0,0,0,0.1);
68
- transition: transform 0.3s;
69
- }
70
- .image-grid img {
71
- width: 100%;
72
- display: block;
73
- }
74
- .image-grid a:hover {
75
- transform: scale(1.05);
76
- }
77
- @media (max-width: 768px) {
78
- .image-grid {
79
- flex-direction: column;
80
- align-items: center;
81
- }
82
- }
83
- </style>
84
- </head>
85
- <body>
86
-
87
- <div class="container">
88
- <h1>🎨 AI Image Generator</h1>
89
-
90
- <form id="generateForm">
91
- <label for="prompt">Prompt</label>
92
- <textarea id="prompt" rows="2" required></textarea>
93
-
94
- <label for="negative">Negative Prompt (optional)</label>
95
- <input type="text" id="negative" placeholder="e.g. blurry, watermark" />
96
-
97
- <label for="model">Model</label>
98
- <select id="model">
99
- <option value="dalle3">DALL·E 3</option>
100
- <option value="dalle2">DALL·E 2</option>
101
- </select>
102
-
103
- <label for="numImages">Number of Images: <span id="numImagesVal">2</span></label>
104
- <input type="range" id="numImages" min="1" max="6" value="2" />
105
-
106
- <label for="width">Width: <span id="widthVal">512</span>px</label>
107
- <input type="range" id="width" min="256" max="1024" step="64" value="512" />
108
-
109
- <label for="height">Height: <span id="heightVal">512</span>px</label>
110
- <input type="range" id="height" min="256" max="1024" step="64" value="512" />
111
-
112
- <label for="strength">Image Strength: <span id="strengthVal">0.5</span></label>
113
- <input type="range" id="strength" min="0" max="1" step="0.1" value="0.5" />
114
-
115
- <button type="submit">🚀 Generate Images</button>
116
- </form>
117
-
118
- <div id="output" class="image-grid"></div>
119
- </div>
120
-
121
- <script>
122
- const form = document.getElementById('generateForm');
123
- const output = document.getElementById('output');
124
-
125
- // Show live values
126
- ['numImages', 'width', 'height', 'strength'].forEach(id => {
127
- const el = document.getElementById(id);
128
- const span = document.getElementById(id + 'Val');
129
- el.addEventListener('input', () => span.textContent = el.value);
130
- });
131
-
132
- form.addEventListener('submit', async (e) => {
133
- e.preventDefault();
134
-
135
- const prompt = document.getElementById('prompt').value;
136
- const negative = document.getElementById('negative').value;
137
- const model = document.getElementById('model').value;
138
- const numImages = document.getElementById('numImages').value;
139
- const width = document.getElementById('width').value;
140
- const height = document.getElementById('height').value;
141
- const strength = document.getElementById('strength').value;
142
-
143
- output.innerHTML = '⏳ Generating images...';
144
-
145
- try {
146
- // Replace with your real backend API call
147
- const dummyImages = Array.from({length: numImages}, (_, i) =>
148
- `https://via.placeholder.com/${width}x${height}?text=Image+${i+1}`
149
- );
150
-
151
- // Display images with download link
152
- output.innerHTML = '';
153
- dummyImages.forEach((src, i) => {
154
- const a = document.createElement('a');
155
- a.href = src;
156
- a.download = `image_${i + 1}.png`;
157
- const img = document.createElement('img');
158
- img.src = src;
159
- a.appendChild(img);
160
- output.appendChild(a);
161
- });
162
-
163
- } catch (err) {
164
- output.innerHTML = `<p style="color:red;">❌ Error generating images. Please try again.</p>`;
165
- }
166
- });
167
- </script>
168
-
169
- </body>
170
- </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1"
8
+ />
9
+
10
+ <script>
11
+ window.__gradio_mode__ = "app";
12
+ 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}]};
13
+ </script>
14
+
15
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
16
+ <link
17
+ rel="preconnect"
18
+ href="https://fonts.gstatic.com"
19
+ crossorigin="anonymous"
20
+ />
21
+ <link
22
+ href="https://fonts.googleapis.com/css?family=Source Sans Pro"
23
+ rel="stylesheet"
24
+ />
25
+ <link
26
+ href="https://fonts.googleapis.com/css?family=IBM Plex Mono"
27
+ rel="stylesheet"
28
+ />
29
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
30
+ <script type="module" crossorigin src="https://gradio.s3-us-west-2.amazonaws.com/3.0.9b12/assets/index.8eca4ae7.js"></script>
31
+ <link rel="stylesheet" href="https://gradio.s3-us-west-2.amazonaws.com/3.0.9b12/assets/index.cbea297d.css">
32
+ <style>
33
+ #screenshot {
34
+ display: none;
35
+ }
36
+ .container > div > div {
37
+ padding: 0.5rem;
38
+ }
39
+ footer a {
40
+ color: rgb(156 163 175) !important;
41
+ }
42
+ footer img {
43
+ display: none !important;
44
+ }
45
+ </style>
46
+ <style id="mofo">
47
+ body {
48
+ display: none !important;
49
+ }
50
+ </style>
51
+ <script type="text/javascript">
52
+ if (self === top || window.location.ancestorOrigins[0] === "https://huggingface.co") {
53
+ var mofo = document.getElementById("mofo");
54
+ mofo.parentNode.removeChild(mofo);
55
+ } else {
56
+ top.location = self.location;
57
+ }
58
+ </script>
59
+ </head>
60
+
61
+ <body
62
+ style="
63
+ margin: 0;
64
+ padding: 0;
65
+ display: flex;
66
+ flex-direction: column;
67
+ flex-grow: 1;
68
+ "
69
+ >
70
+ <div
71
+ id="root"
72
+ style="display: flex; flex-direction: column; flex-grow: 1"
73
+ ></div>
74
+ <script src="html2canvas.js"></script>
75
+ </body>
76
+ </html>