MySafeCode commited on
Commit
d5c10df
·
verified ·
1 Parent(s): 7ac7ae9

Delete index.html

Browse files
Files changed (1) hide show
  1. index.html +0 -513
index.html DELETED
@@ -1,513 +0,0 @@
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>Pixazo Image Generator</title>
7
- <style>
8
- * {
9
- margin: 0;
10
- padding: 0;
11
- box-sizing: border-box;
12
- }
13
-
14
- body {
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
16
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
17
- min-height: 100vh;
18
- padding: 20px;
19
- }
20
-
21
- .container {
22
- max-width: 800px;
23
- margin: 0 auto;
24
- background: white;
25
- border-radius: 20px;
26
- box-shadow: 0 20px 60px rgba(0,0,0,0.3);
27
- overflow: hidden;
28
- }
29
-
30
- .header {
31
- background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
32
- color: white;
33
- padding: 30px;
34
- text-align: center;
35
- }
36
-
37
- .header h1 {
38
- font-size: 2.5rem;
39
- margin-bottom: 10px;
40
- display: flex;
41
- align-items: center;
42
- justify-content: center;
43
- gap: 15px;
44
- }
45
-
46
- .header p {
47
- opacity: 0.9;
48
- font-size: 1.1rem;
49
- }
50
-
51
- .content {
52
- padding: 30px;
53
- }
54
-
55
- .form-group {
56
- margin-bottom: 25px;
57
- }
58
-
59
- label {
60
- display: block;
61
- margin-bottom: 8px;
62
- font-weight: 600;
63
- color: #333;
64
- font-size: 1.1rem;
65
- }
66
-
67
- textarea {
68
- width: 100%;
69
- padding: 15px;
70
- border: 2px solid #e5e7eb;
71
- border-radius: 10px;
72
- font-size: 1rem;
73
- resize: vertical;
74
- min-height: 120px;
75
- font-family: inherit;
76
- transition: border-color 0.3s;
77
- }
78
-
79
- textarea:focus {
80
- outline: none;
81
- border-color: #4f46e5;
82
- }
83
-
84
- .controls {
85
- display: grid;
86
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
87
- gap: 20px;
88
- margin-bottom: 25px;
89
- }
90
-
91
- .control {
92
- display: flex;
93
- flex-direction: column;
94
- }
95
-
96
- input[type="number"], select {
97
- padding: 12px 15px;
98
- border: 2px solid #e5e7eb;
99
- border-radius: 10px;
100
- font-size: 1rem;
101
- transition: border-color 0.3s;
102
- }
103
-
104
- input[type="number"]:focus, select:focus {
105
- outline: none;
106
- border-color: #4f46e5;
107
- }
108
-
109
- .btn-generate {
110
- background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
111
- color: white;
112
- border: none;
113
- padding: 18px 30px;
114
- font-size: 1.2rem;
115
- font-weight: 600;
116
- border-radius: 12px;
117
- cursor: pointer;
118
- width: 100%;
119
- transition: transform 0.3s, box-shadow 0.3s;
120
- margin-bottom: 25px;
121
- }
122
-
123
- .btn-generate:hover {
124
- transform: translateY(-2px);
125
- box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
126
- }
127
-
128
- .btn-generate:disabled {
129
- opacity: 0.6;
130
- cursor: not-allowed;
131
- transform: none;
132
- }
133
-
134
- .result-container {
135
- display: none;
136
- background: #f9fafb;
137
- border-radius: 15px;
138
- padding: 25px;
139
- margin-top: 25px;
140
- border: 2px dashed #d1d5db;
141
- }
142
-
143
- .result-container.active {
144
- display: block;
145
- }
146
-
147
- .result-header {
148
- display: flex;
149
- justify-content: space-between;
150
- align-items: center;
151
- margin-bottom: 20px;
152
- }
153
-
154
- .result-header h3 {
155
- color: #333;
156
- }
157
-
158
- #imageResult {
159
- max-width: 100%;
160
- border-radius: 10px;
161
- display: none;
162
- }
163
-
164
- #imageResult.loaded {
165
- display: block;
166
- animation: fadeIn 0.5s ease;
167
- }
168
-
169
- .loading {
170
- display: none;
171
- text-align: center;
172
- padding: 40px;
173
- }
174
-
175
- .loading.active {
176
- display: block;
177
- }
178
-
179
- .spinner {
180
- width: 50px;
181
- height: 50px;
182
- border: 5px solid #e5e7eb;
183
- border-top: 5px solid #4f46e5;
184
- border-radius: 50%;
185
- animation: spin 1s linear infinite;
186
- margin: 0 auto 20px;
187
- }
188
-
189
- .error {
190
- background: #fee2e2;
191
- border: 2px solid #fca5a5;
192
- color: #dc2626;
193
- padding: 15px;
194
- border-radius: 10px;
195
- margin-top: 20px;
196
- display: none;
197
- }
198
-
199
- .error.active {
200
- display: block;
201
- }
202
-
203
- @keyframes spin {
204
- 0% { transform: rotate(0deg); }
205
- 100% { transform: rotate(360deg); }
206
- }
207
-
208
- @keyframes fadeIn {
209
- from { opacity: 0; transform: translateY(10px); }
210
- to { opacity: 1; transform: translateY(0); }
211
- }
212
-
213
- .example-prompts {
214
- margin-top: 30px;
215
- padding-top: 25px;
216
- border-top: 2px solid #e5e7eb;
217
- }
218
-
219
- .example-prompts h3 {
220
- margin-bottom: 15px;
221
- color: #333;
222
- }
223
-
224
- .examples {
225
- display: grid;
226
- grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
227
- gap: 15px;
228
- }
229
-
230
- .example {
231
- background: #f3f4f6;
232
- padding: 15px;
233
- border-radius: 10px;
234
- cursor: pointer;
235
- transition: all 0.3s;
236
- }
237
-
238
- .example:hover {
239
- background: #e5e7eb;
240
- transform: translateY(-2px);
241
- }
242
-
243
- .example h4 {
244
- color: #4f46e5;
245
- margin-bottom: 8px;
246
- font-size: 1rem;
247
- }
248
-
249
- .example p {
250
- color: #666;
251
- font-size: 0.9rem;
252
- }
253
-
254
- @media (max-width: 600px) {
255
- .container {
256
- border-radius: 15px;
257
- }
258
-
259
- .header {
260
- padding: 20px;
261
- }
262
-
263
- .header h1 {
264
- font-size: 2rem;
265
- }
266
-
267
- .content {
268
- padding: 20px;
269
- }
270
-
271
- .controls {
272
- grid-template-columns: 1fr;
273
- }
274
- }
275
- </style>
276
- </head>
277
- <body>
278
- <div class="container">
279
- <div class="header">
280
- <h1>🎨 Pixazo Image Generator</h1>
281
- <p>Generate stunning AI images with FLUX-1 Schnell</p>
282
- </div>
283
-
284
- <div class="content">
285
- <div class="form-group">
286
- <label for="prompt">Image Prompt</label>
287
- <textarea id="prompt" placeholder="Describe the image you want to generate..."></textarea>
288
- </div>
289
-
290
- <div class="controls">
291
- <div class="control">
292
- <label for="steps">Number of Steps</label>
293
- <input type="number" id="steps" min="1" max="50" value="4">
294
- </div>
295
-
296
- <div class="control">
297
- <label for="seed">Seed (0 for random)</label>
298
- <input type="number" id="seed" min="0" max="999999" value="15">
299
- </div>
300
-
301
- <div class="control">
302
- <label for="size">Image Size</label>
303
- <select id="size">
304
- <option value="512x512">512x512</option>
305
- <option value="768x512">768x512 (Landscape)</option>
306
- <option value="512x768">512x768 (Portrait)</option>
307
- </select>
308
- </div>
309
- </div>
310
-
311
- <button id="generateBtn" class="btn-generate">Generate Image</button>
312
-
313
- <div class="loading" id="loading">
314
- <div class="spinner"></div>
315
- <p>Generating your image... This may take a moment.</p>
316
- </div>
317
-
318
- <div class="result-container" id="resultContainer">
319
- <div class="result-header">
320
- <h3>Generated Image</h3>
321
- <button id="downloadBtn" style="display: none;">Download</button>
322
- </div>
323
- <img id="imageResult" alt="Generated image">
324
- </div>
325
-
326
- <div class="error" id="error"></div>
327
-
328
- <div class="example-prompts">
329
- <h3>Try these examples:</h3>
330
- <div class="examples">
331
- <div class="example" onclick="useExample(this)">
332
- <h4>Cyberpunk City</h4>
333
- <p>A futuristic cyberpunk city at night with neon lights and flying cars</p>
334
- </div>
335
- <div class="example" onclick="useExample(this)">
336
- <h4>Fantasy Landscape</h4>
337
- <p>A magical forest with glowing mushrooms and fairies</p>
338
- </div>
339
- <div class="example" onclick="useExample(this)">
340
- <h4>Space Explorer</h4>
341
- <p>An astronaut exploring an alien planet with two suns</p>
342
- </div>
343
- </div>
344
- </div>
345
- </div>
346
- </div>
347
-
348
- <script>
349
- const API_ENDPOINT = '/api/generate'; // Proxy to our backend
350
-
351
- document.getElementById('generateBtn').addEventListener('click', generateImage);
352
- document.getElementById('downloadBtn').addEventListener('click', downloadImage);
353
-
354
- function useExample(exampleEl) {
355
- const prompt = exampleEl.querySelector('p').textContent;
356
- document.getElementById('prompt').value = prompt;
357
- }
358
-
359
- async function generateImage() {
360
- // Get form values
361
- const prompt = document.getElementById('prompt').value.trim();
362
- const steps = parseInt(document.getElementById('steps').value);
363
- const seed = parseInt(document.getElementById('seed').value);
364
- const size = document.getElementById('size').value;
365
-
366
- if (!prompt) {
367
- showError('Please enter a prompt');
368
- return;
369
- }
370
-
371
- // Parse size
372
- const [width, height] = size.split('x').map(Number);
373
-
374
- // Show loading
375
- showLoading(true);
376
- hideError();
377
- hideResult();
378
-
379
- try {
380
- const body = {
381
- prompt: prompt,
382
- num_steps: steps,
383
- seed: seed || Math.floor(Math.random() * 999999),
384
- height: height,
385
- width: width
386
- };
387
-
388
- console.log('Sending request:', body);
389
-
390
- const response = await fetch(API_ENDPOINT, {
391
- method: 'POST',
392
- headers: {
393
- 'Content-Type': 'application/json',
394
- },
395
- body: JSON.stringify(body)
396
- });
397
-
398
- console.log('Response status:', response.status);
399
-
400
- if (!response.ok) {
401
- const errorData = await response.json();
402
- throw new Error(errorData.error || `API returned ${response.status}`);
403
- }
404
-
405
- const data = await response.json();
406
- console.log('Response data:', data);
407
-
408
- // Handle the response based on Pixazo's actual response format
409
- // This assumes the API returns image data in some format
410
- displayResult(data);
411
-
412
- } catch (error) {
413
- console.error('Error:', error);
414
- showError(error.message || 'Failed to generate image');
415
- } finally {
416
- showLoading(false);
417
- }
418
- }
419
-
420
- function displayResult(data) {
421
- // This function needs to be adjusted based on Pixazo's actual response format
422
- // Here are a few possibilities:
423
-
424
- // 1. If Pixazo returns a direct image URL:
425
- // if (data.image_url) {
426
- // document.getElementById('imageResult').src = data.image_url;
427
- // showResult();
428
- // }
429
-
430
- // 2. If Pixazo returns base64 image data:
431
- // if (data.image_base64) {
432
- // document.getElementById('imageResult').src = `data:image/png;base64,${data.image_base64}`;
433
- // showResult();
434
- // }
435
-
436
- // 3. For now, let's just show the response data
437
- console.log('Full response:', data);
438
-
439
- // Show a message instead of an image
440
- const resultContainer = document.getElementById('resultContainer');
441
- const imageResult = document.getElementById('imageResult');
442
-
443
- // Hide image and show text message
444
- imageResult.style.display = 'none';
445
- resultContainer.innerHTML = `
446
- <div class="result-header">
447
- <h3>API Response</h3>
448
- </div>
449
- <pre style="background: white; padding: 15px; border-radius: 10px; overflow: auto;">${JSON.stringify(data, null, 2)}</pre>
450
- <p style="margin-top: 15px; color: #666;">
451
- The API call was successful! Check the console for the complete response.
452
- <br>You'll need to adjust the displayResult() function based on Pixazo's actual response format.
453
- </p>
454
- `;
455
- resultContainer.classList.add('active');
456
- }
457
-
458
- function showResult() {
459
- const resultContainer = document.getElementById('resultContainer');
460
- const imageResult = document.getElementById('imageResult');
461
-
462
- imageResult.classList.add('loaded');
463
- resultContainer.classList.add('active');
464
- document.getElementById('downloadBtn').style.display = 'block';
465
- }
466
-
467
- function hideResult() {
468
- const resultContainer = document.getElementById('resultContainer');
469
- const imageResult = document.getElementById('imageResult');
470
-
471
- imageResult.classList.remove('loaded');
472
- resultContainer.classList.remove('active');
473
- document.getElementById('downloadBtn').style.display = 'none';
474
- }
475
-
476
- function downloadImage() {
477
- const imageUrl = document.getElementById('imageResult').src;
478
- const link = document.createElement('a');
479
- link.href = imageUrl;
480
- link.download = `pixazo-${Date.now()}.png`;
481
- document.body.appendChild(link);
482
- link.click();
483
- document.body.removeChild(link);
484
- }
485
-
486
- function showLoading(show) {
487
- const loading = document.getElementById('loading');
488
- const button = document.getElementById('generateBtn');
489
-
490
- if (show) {
491
- loading.classList.add('active');
492
- button.disabled = true;
493
- button.textContent = 'Generating...';
494
- } else {
495
- loading.classList.remove('active');
496
- button.disabled = false;
497
- button.textContent = 'Generate Image';
498
- }
499
- }
500
-
501
- function showError(message) {
502
- const errorDiv = document.getElementById('error');
503
- errorDiv.textContent = `Error: ${message}`;
504
- errorDiv.classList.add('active');
505
- }
506
-
507
- function hideError() {
508
- const errorDiv = document.getElementById('error');
509
- errorDiv.classList.remove('active');
510
- }
511
- </script>
512
- </body>
513
- </html>