tahercoolguy
commited on
Uploaded starting files
Browse files- app.js +63 -0
- index.html +94 -19
- style.css +249 -28
app.js
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
new Vue({
|
2 |
+
el: '#app',
|
3 |
+
data: {
|
4 |
+
prompt: '',
|
5 |
+
selectedStyle: 'realistic',
|
6 |
+
selectedSize: 'medium',
|
7 |
+
generatedImage: null,
|
8 |
+
isGenerating: false,
|
9 |
+
maxChars: 500
|
10 |
+
},
|
11 |
+
computed: {
|
12 |
+
remainingChars() {
|
13 |
+
return this.maxChars - this.prompt.length;
|
14 |
+
}
|
15 |
+
},
|
16 |
+
methods: {
|
17 |
+
updateCharCount() {
|
18 |
+
if (this.prompt.length > this.maxChars) {
|
19 |
+
this.prompt = this.prompt.substring(0, this.maxChars);
|
20 |
+
}
|
21 |
+
},
|
22 |
+
generateImage() {
|
23 |
+
// Simulate image generation (in a real application, this would call an AI API)
|
24 |
+
this.isGenerating = true;
|
25 |
+
setTimeout(() => {
|
26 |
+
// For demo purposes, we're using a placeholder image
|
27 |
+
this.generatedImage = 'https://via.placeholder.com/512x512.png?text=AI+Generated+Image';
|
28 |
+
this.isGenerating = false;
|
29 |
+
}, 2000);
|
30 |
+
},
|
31 |
+
downloadImage() {
|
32 |
+
if (this.generatedImage) {
|
33 |
+
const link = document.createElement('a');
|
34 |
+
link.href = this.generatedImage;
|
35 |
+
link.download = 'ai-generated-image.png';
|
36 |
+
document.body.appendChild(link);
|
37 |
+
link.click();
|
38 |
+
document.body.removeChild(link);
|
39 |
+
}
|
40 |
+
},
|
41 |
+
shareImage() {
|
42 |
+
if (this.generatedImage) {
|
43 |
+
// Check if the Web Share API is available
|
44 |
+
if (navigator.share) {
|
45 |
+
navigator.share({
|
46 |
+
title: 'AI Generated Image',
|
47 |
+
text: 'Check out this AI-generated image!',
|
48 |
+
url: window.location.href
|
49 |
+
}).catch(console.error);
|
50 |
+
} else {
|
51 |
+
// Fallback: Copy the URL to clipboard
|
52 |
+
const dummy = document.createElement('input');
|
53 |
+
document.body.appendChild(dummy);
|
54 |
+
dummy.value = window.location.href;
|
55 |
+
dummy.select();
|
56 |
+
document.execCommand('copy');
|
57 |
+
document.body.removeChild(dummy);
|
58 |
+
alert('URL copied to clipboard!');
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
});
|
index.html
CHANGED
@@ -1,19 +1,94 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 | Saif's AI</title>
|
7 |
+
<link rel="stylesheet" href="style.css">
|
8 |
+
<!-- Vue.js CDN -->
|
9 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
|
10 |
+
<!-- Font Awesome -->
|
11 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div id="app">
|
15 |
+
<nav class="navbar">
|
16 |
+
<div class="logo">
|
17 |
+
<a href="https://saifs.ai" target="_blank">
|
18 |
+
<i class="fas fa-brain"></i> Saif's AI
|
19 |
+
</a>
|
20 |
+
</div>
|
21 |
+
<div class="nav-links">
|
22 |
+
<a href="https://saifs.ai" target="_blank">Visit Our Website</a>
|
23 |
+
</div>
|
24 |
+
</nav>
|
25 |
+
|
26 |
+
<main class="container">
|
27 |
+
<h1 class="title">AI Image Generator</h1>
|
28 |
+
<p class="subtitle">Transform your ideas into stunning visuals with AI</p>
|
29 |
+
|
30 |
+
<div class="generator-container">
|
31 |
+
<div class="input-section">
|
32 |
+
<textarea
|
33 |
+
v-model="prompt"
|
34 |
+
placeholder="Describe the image you want to generate..."
|
35 |
+
@keyup="updateCharCount"
|
36 |
+
></textarea>
|
37 |
+
<div class="char-count">{{ remainingChars }} characters remaining</div>
|
38 |
+
|
39 |
+
<div class="options">
|
40 |
+
<select v-model="selectedStyle">
|
41 |
+
<option value="realistic">Realistic</option>
|
42 |
+
<option value="artistic">Artistic</option>
|
43 |
+
<option value="cartoon">Cartoon</option>
|
44 |
+
<option value="abstract">Abstract</option>
|
45 |
+
</select>
|
46 |
+
|
47 |
+
<select v-model="selectedSize">
|
48 |
+
<option value="small">Small (256x256)</option>
|
49 |
+
<option value="medium">Medium (512x512)</option>
|
50 |
+
<option value="large">Large (1024x1024)</option>
|
51 |
+
</select>
|
52 |
+
</div>
|
53 |
+
|
54 |
+
<button
|
55 |
+
@click="generateImage"
|
56 |
+
:disabled="!prompt || isGenerating"
|
57 |
+
:class="{ 'generating': isGenerating }"
|
58 |
+
>
|
59 |
+
<i class="fas fa-magic"></i>
|
60 |
+
{{ isGenerating ? 'Generating...' : 'Generate Image' }}
|
61 |
+
</button>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<div class="preview-section">
|
65 |
+
<div class="preview-container" :class="{ 'has-image': generatedImage }">
|
66 |
+
<template v-if="generatedImage">
|
67 |
+
<img :src="generatedImage" alt="Generated Image">
|
68 |
+
<div class="image-actions">
|
69 |
+
<button @click="downloadImage">
|
70 |
+
<i class="fas fa-download"></i> Download
|
71 |
+
</button>
|
72 |
+
<button @click="shareImage">
|
73 |
+
<i class="fas fa-share"></i> Share
|
74 |
+
</button>
|
75 |
+
</div>
|
76 |
+
</template>
|
77 |
+
<div v-else class="placeholder">
|
78 |
+
<i class="fas fa-image"></i>
|
79 |
+
<p>Your generated image will appear here</p>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
</main>
|
85 |
+
|
86 |
+
<footer>
|
87 |
+
<p>Created with ❤️ by <a href="https://saifs.ai" target="_blank">Saif's AI</a></p>
|
88 |
+
<p>Experience more AI solutions at <a href="https://saifs.ai" target="_blank">saifs.ai</a></p>
|
89 |
+
</footer>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<script src="app.js"></script>
|
93 |
+
</body>
|
94 |
+
</html>
|
style.css
CHANGED
@@ -1,28 +1,249 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
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+
|
10 |
+
* {
|
11 |
+
margin: 0;
|
12 |
+
padding: 0;
|
13 |
+
box-sizing: border-box;
|
14 |
+
}
|
15 |
+
|
16 |
+
body {
|
17 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
18 |
+
background-color: var(--background-color);
|
19 |
+
color: var(--text-color);
|
20 |
+
line-height: 1.6;
|
21 |
+
}
|
22 |
+
|
23 |
+
#app {
|
24 |
+
min-height: 100vh;
|
25 |
+
display: flex;
|
26 |
+
flex-direction: column;
|
27 |
+
}
|
28 |
+
|
29 |
+
.navbar {
|
30 |
+
background-color: white;
|
31 |
+
padding: 1rem 2rem;
|
32 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
33 |
+
display: flex;
|
34 |
+
justify-content: space-between;
|
35 |
+
align-items: center;
|
36 |
+
}
|
37 |
+
|
38 |
+
.logo a {
|
39 |
+
color: var(--primary-color);
|
40 |
+
text-decoration: none;
|
41 |
+
font-size: 1.5rem;
|
42 |
+
font-weight: bold;
|
43 |
+
display: flex;
|
44 |
+
align-items: center;
|
45 |
+
gap: 0.5rem;
|
46 |
+
}
|
47 |
+
|
48 |
+
.nav-links a {
|
49 |
+
color: var(--text-color);
|
50 |
+
text-decoration: none;
|
51 |
+
padding: 0.5rem 1rem;
|
52 |
+
border-radius: 0.5rem;
|
53 |
+
transition: all 0.3s ease;
|
54 |
+
}
|
55 |
+
|
56 |
+
.nav-links a:hover {
|
57 |
+
background-color: var(--primary-color);
|
58 |
+
color: white;
|
59 |
+
}
|
60 |
+
|
61 |
+
.container {
|
62 |
+
max-width: 1200px;
|
63 |
+
margin: 2rem auto;
|
64 |
+
padding: 0 1rem;
|
65 |
+
flex: 1;
|
66 |
+
}
|
67 |
+
|
68 |
+
.title {
|
69 |
+
text-align: center;
|
70 |
+
font-size: 2.5rem;
|
71 |
+
color: var(--primary-color);
|
72 |
+
margin-bottom: 0.5rem;
|
73 |
+
}
|
74 |
+
|
75 |
+
.subtitle {
|
76 |
+
text-align: center;
|
77 |
+
color: var(--text-color);
|
78 |
+
opacity: 0.8;
|
79 |
+
margin-bottom: 2rem;
|
80 |
+
}
|
81 |
+
|
82 |
+
.generator-container {
|
83 |
+
display: grid;
|
84 |
+
grid-template-columns: 1fr 1fr;
|
85 |
+
gap: 2rem;
|
86 |
+
background: white;
|
87 |
+
padding: 2rem;
|
88 |
+
border-radius: 1rem;
|
89 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
90 |
+
}
|
91 |
+
|
92 |
+
.input-section {
|
93 |
+
display: flex;
|
94 |
+
flex-direction: column;
|
95 |
+
gap: 1rem;
|
96 |
+
}
|
97 |
+
|
98 |
+
textarea {
|
99 |
+
width: 100%;
|
100 |
+
height: 150px;
|
101 |
+
padding: 1rem;
|
102 |
+
border: 2px solid var(--border-color);
|
103 |
+
border-radius: 0.5rem;
|
104 |
+
resize: none;
|
105 |
+
font-size: 1rem;
|
106 |
+
transition: border-color 0.3s ease;
|
107 |
+
}
|
108 |
+
|
109 |
+
textarea:focus {
|
110 |
+
outline: none;
|
111 |
+
border-color: var(--primary-color);
|
112 |
+
}
|
113 |
+
|
114 |
+
.char-count {
|
115 |
+
font-size: 0.9rem;
|
116 |
+
color: var(--text-color);
|
117 |
+
opacity: 0.7;
|
118 |
+
}
|
119 |
+
|
120 |
+
.options {
|
121 |
+
display: flex;
|
122 |
+
gap: 1rem;
|
123 |
+
}
|
124 |
+
|
125 |
+
select {
|
126 |
+
flex: 1;
|
127 |
+
padding: 0.75rem;
|
128 |
+
border: 2px solid var(--border-color);
|
129 |
+
border-radius: 0.5rem;
|
130 |
+
font-size: 1rem;
|
131 |
+
cursor: pointer;
|
132 |
+
background-color: white;
|
133 |
+
}
|
134 |
+
|
135 |
+
select:focus {
|
136 |
+
outline: none;
|
137 |
+
border-color: var(--primary-color);
|
138 |
+
}
|
139 |
+
|
140 |
+
button {
|
141 |
+
background-color: var(--primary-color);
|
142 |
+
color: white;
|
143 |
+
border: none;
|
144 |
+
padding: 1rem;
|
145 |
+
border-radius: 0.5rem;
|
146 |
+
font-size: 1rem;
|
147 |
+
cursor: pointer;
|
148 |
+
transition: all 0.3s ease;
|
149 |
+
display: flex;
|
150 |
+
align-items: center;
|
151 |
+
justify-content: center;
|
152 |
+
gap: 0.5rem;
|
153 |
+
}
|
154 |
+
|
155 |
+
button:hover {
|
156 |
+
background-color: var(--hover-color);
|
157 |
+
}
|
158 |
+
|
159 |
+
button:disabled {
|
160 |
+
background-color: var(--border-color);
|
161 |
+
cursor: not-allowed;
|
162 |
+
}
|
163 |
+
|
164 |
+
button.generating {
|
165 |
+
animation: pulse 1.5s infinite;
|
166 |
+
}
|
167 |
+
|
168 |
+
.preview-section {
|
169 |
+
display: flex;
|
170 |
+
align-items: center;
|
171 |
+
justify-content: center;
|
172 |
+
}
|
173 |
+
|
174 |
+
.preview-container {
|
175 |
+
width: 100%;
|
176 |
+
aspect-ratio: 1;
|
177 |
+
border: 2px dashed var(--border-color);
|
178 |
+
border-radius: 0.5rem;
|
179 |
+
display: flex;
|
180 |
+
align-items: center;
|
181 |
+
justify-content: center;
|
182 |
+
flex-direction: column;
|
183 |
+
gap: 1rem;
|
184 |
+
padding: 1rem;
|
185 |
+
background-color: #f8fafc;
|
186 |
+
}
|
187 |
+
|
188 |
+
.preview-container.has-image {
|
189 |
+
border-style: solid;
|
190 |
+
}
|
191 |
+
|
192 |
+
.preview-container img {
|
193 |
+
max-width: 100%;
|
194 |
+
max-height: 100%;
|
195 |
+
border-radius: 0.5rem;
|
196 |
+
}
|
197 |
+
|
198 |
+
.placeholder {
|
199 |
+
text-align: center;
|
200 |
+
color: var(--text-color);
|
201 |
+
opacity: 0.5;
|
202 |
+
}
|
203 |
+
|
204 |
+
.placeholder i {
|
205 |
+
font-size: 3rem;
|
206 |
+
margin-bottom: 1rem;
|
207 |
+
}
|
208 |
+
|
209 |
+
.image-actions {
|
210 |
+
display: flex;
|
211 |
+
gap: 1rem;
|
212 |
+
margin-top: 1rem;
|
213 |
+
}
|
214 |
+
|
215 |
+
footer {
|
216 |
+
text-align: center;
|
217 |
+
padding: 2rem;
|
218 |
+
background-color: white;
|
219 |
+
margin-top: auto;
|
220 |
+
}
|
221 |
+
|
222 |
+
footer a {
|
223 |
+
color: var(--primary-color);
|
224 |
+
text-decoration: none;
|
225 |
+
}
|
226 |
+
|
227 |
+
footer a:hover {
|
228 |
+
text-decoration: underline;
|
229 |
+
}
|
230 |
+
|
231 |
+
@keyframes pulse {
|
232 |
+
0% { opacity: 1; }
|
233 |
+
50% { opacity: 0.7; }
|
234 |
+
100% { opacity: 1; }
|
235 |
+
}
|
236 |
+
|
237 |
+
@media (max-width: 768px) {
|
238 |
+
.generator-container {
|
239 |
+
grid-template-columns: 1fr;
|
240 |
+
}
|
241 |
+
|
242 |
+
.title {
|
243 |
+
font-size: 2rem;
|
244 |
+
}
|
245 |
+
|
246 |
+
.options {
|
247 |
+
flex-direction: column;
|
248 |
+
}
|
249 |
+
}
|