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

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +136 -141
index.html CHANGED
@@ -1,175 +1,170 @@
 
1
  <html lang="en">
2
  <head>
3
  <meta charset="UTF-8" />
4
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
- <title>DALL·E Mini - 4 Image Generator</title>
6
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet" />
7
  <style>
8
- :root {
9
- --bg-color: #121212;
10
- --card-color: #1e1e1e;
11
- --text-color: #f0f0f0;
12
- --accent-color: #4ade80;
13
- }
14
-
15
- * {
16
- box-sizing: border-box;
17
- }
18
-
19
  body {
 
 
20
  margin: 0;
21
- background: var(--bg-color);
22
- color: var(--text-color);
23
- font-family: 'Inter', sans-serif;
 
 
 
24
  }
25
-
26
  .container {
27
  max-width: 960px;
28
  margin: auto;
29
- padding: 2rem;
30
- }
31
-
32
- h1 {
33
- text-align: center;
34
- font-size: 2rem;
35
- margin-bottom: 0.5rem;
36
  }
37
-
38
- p {
39
- text-align: center;
40
- font-size: 1rem;
41
- color: #ccc;
42
  }
43
-
44
- .input-area {
45
- display: flex;
46
- flex-direction: column;
47
- gap: 1rem;
48
- margin: 2rem 0;
49
- align-items: center;
50
  }
51
-
52
- input[type="text"] {
53
- padding: 0.8rem 1rem;
54
- border: none;
55
- border-radius: 8px;
56
  width: 100%;
57
- max-width: 600px;
58
- font-size: 1rem;
59
- background: #2a2a2a;
60
- color: var(--text-color);
61
  }
62
-
63
  button {
64
- padding: 0.8rem 1.5rem;
65
- background: var(--accent-color);
66
  border: none;
67
- border-radius: 8px;
68
- font-weight: 600;
69
- color: #000;
70
  cursor: pointer;
71
- transition: 0.3s ease;
 
72
  }
73
-
74
  button:hover {
75
- background: #22c55e;
76
  }
77
-
78
- #gallery {
79
- display: grid;
80
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
81
- gap: 1rem;
82
- margin-top: 2rem;
83
  }
84
-
85
- #gallery img {
86
  width: 100%;
87
- border-radius: 10px;
88
- object-fit: cover;
89
- cursor: pointer;
90
- }
91
-
92
- .loader {
93
- text-align: center;
94
- font-size: 1rem;
95
- color: #999;
96
- margin-top: 2rem;
97
  }
98
-
99
- footer {
100
- margin-top: 3rem;
101
- text-align: center;
102
- font-size: 0.85rem;
103
- color: #888;
104
  }
105
-
106
- a {
107
- color: var(--accent-color);
108
- text-decoration: none;
109
  }
110
-
111
- @media (max-width: 500px) {
112
- input[type="text"] {
113
- width: 90%;
114
  }
115
  }
116
  </style>
117
  </head>
118
  <body>
119
- <div class="container">
120
- <h1>DALL·E Mini by <a href="https://www.craiyon.com/" target="_blank">Craiyon</a></h1>
121
- <p>Generate 4 AI images instantly</p>
122
-
123
- <div class="input-area">
124
- <input id="prompt" type="text" placeholder="E.g. astronaut riding a unicorn in space" />
125
- <button onclick="runPrompt()">Generate Images</button>
126
- </div>
127
-
128
- <div id="gallery"></div>
129
- <div class="loader" id="loader"></div>
130
-
131
- <footer>
132
- Built by <a href="https://twitter.com/borisdayma" target="_blank">Boris Dayma</a> • Powered by <a href="https://www.craiyon.com/" target="_blank">Craiyon</a>
133
- </footer>
134
- </div>
135
-
136
- <script>
137
- async function runPrompt() {
138
- const prompt = document.getElementById("prompt").value.trim();
139
- const gallery = document.getElementById("gallery");
140
- const loader = document.getElementById("loader");
141
-
142
- gallery.innerHTML = "";
143
- loader.textContent = "Generating images... Please wait.";
144
-
145
- if (!prompt) {
146
- loader.textContent = "Please enter a prompt.";
147
- return;
148
- }
149
 
150
- try {
151
- const res = await fetch("https://bf.dallemini.ai/generate", {
152
- method: "POST",
153
- headers: { "Content-Type": "application/json" },
154
- body: JSON.stringify({ prompt })
155
- });
156
-
157
- const data = await res.json();
158
- const images = (data.images || []).slice(0, 4); // Limit to 4 images
159
-
160
- if (images.length > 0) {
161
- gallery.innerHTML = images.map((img, index) => {
162
- const imgSrc = data:image/png;base64,${img};
163
- return <a href="${imgSrc}" download="image_${index + 1}.png"><img src="${imgSrc}" alt="Generated Image" /></a>;
164
- }).join("");
165
- loader.textContent = "";
166
- } else {
167
- loader.textContent = "No images returned. Try a different prompt.";
168
- }
169
- } catch (error) {
170
- loader.textContent = "Error: Server busy or unreachable. Try again later.";
171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  }
173
- </script>
 
 
174
  </body>
175
- </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.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>