jasvir-singh1021 commited on
Commit
c8c0dcb
·
verified ·
1 Parent(s): 9069029

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,12 +1,49 @@
1
- ---
2
- title: Stellar Verse
3
- emoji: 📊
4
- colorFrom: gray
5
- colorTo: pink
6
- sdk: static
7
- pinned: false
8
- tags:
9
- - anycoder
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stellar Verse - Romantic Poetry Generator
2
+
3
+ A beautiful, responsive web application that generates romantic poems with dynamic backgrounds.
4
+
5
+ ## Features
6
+
7
+ - Generate romantic poems based on keywords or themes
8
+ - Dynamic background images that change with each poem generation
9
+ - Manual background selection from romantic themes
10
+ - Responsive design for all screen sizes
11
+ - Keyboard shortcuts for better accessibility
12
+ - Elegant typography and warm color scheme
13
+
14
+ ## How to Use
15
+
16
+ 1. Enter keywords or themes in the input field (e.g., "moon", "love", "autumn")
17
+ 2. Click "Generate Poem" or press Enter
18
+ 3. Enjoy your romantic poem with a beautiful background
19
+ 4. Use the background controls to change the visual theme
20
+
21
+ ## Technical Details
22
+
23
+ - Built with semantic HTML5, CSS3, and vanilla JavaScript
24
+ - Mobile-first responsive design
25
+ - Accessible with proper ARIA labels and keyboard navigation
26
+ - SVG-based backgrounds for crisp display at any resolution
27
+
28
+ ## Future Enhancements
29
+
30
+ - Add more poems and background options
31
+ - Implement actual AI-based poem generation
32
+ - Add user accounts to save favorite poems
33
+ - Include sharing options for social media
34
+
35
+ ## Running the Application
36
+
37
+ Simply open the `index.html` file in your web browser. No server required!
38
+
39
+ ## License
40
+
41
+ This project is licensed under the MIT License.
42
+
43
+ ## Credits
44
+
45
+ - Fonts from Google Fonts
46
+ - Background designs created with SVG
47
+ - Built with love and poetry in mind
48
+
49
+ Enjoy expressing your romantic feelings through Stellar Verse!
assets/css/styles.css ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --primary-color: #d4a373;
3
+ --secondary-color: #e67e22;
4
+ --dark-color: #2c3e50;
5
+ --light-color: #ecf0f1;
6
+ --accent-color: #e74c3c;
7
+ --text-color: #333;
8
+ --text-light: #fff;
9
+ }
10
+
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ font-family: 'Raleway', sans-serif;
19
+ line-height: 1.6;
20
+ color: var(--text-color);
21
+ background-color: var(--light-color);
22
+ transition: background-image 1s ease-in-out;
23
+ min-height: 100vh;
24
+ display: flex;
25
+ flex-direction: column;
26
+ }
27
+
28
+ .header {
29
+ background-color: var(--primary-color);
30
+ color: var(--text-light);
31
+ padding: 1rem;
32
+ text-align: center;
33
+ position: relative;
34
+ }
35
+
36
+ .header-link {
37
+ position: absolute;
38
+ top: 0.5rem;
39
+ right: 1rem;
40
+ font-size: 0.8rem;
41
+ }
42
+
43
+ .header-link a {
44
+ color: var(--text-light);
45
+ text-decoration: none;
46
+ }
47
+
48
+ .header-link a:hover {
49
+ text-decoration: underline;
50
+ }
51
+
52
+ .main-content {
53
+ flex: 1;
54
+ padding: 2rem;
55
+ max-width: 1200px;
56
+ margin: 0 auto;
57
+ width: 100%;
58
+ }
59
+
60
+ h1, h2 {
61
+ font-family: 'Playfair Display', serif;
62
+ margin-bottom: 1rem;
63
+ }
64
+
65
+ h1 {
66
+ font-size: 2.5rem;
67
+ margin-bottom: 0;
68
+ }
69
+
70
+ h2 {
71
+ font-size: 1.8rem;
72
+ color: var(--dark-color);
73
+ text-align: center;
74
+ margin-bottom: 2rem;
75
+ }
76
+
77
+ .poem-generator {
78
+ background-color: white;
79
+ padding: 2rem;
80
+ border-radius: 8px;
81
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
82
+ margin-bottom: 2rem;
83
+ }
84
+
85
+ .input-group {
86
+ display: flex;
87
+ gap: 1rem;
88
+ margin-bottom: 1.5rem;
89
+ }
90
+
91
+ input[type="text"] {
92
+ flex: 1;
93
+ padding: 0.8rem;
94
+ border: 1px solid #ddd;
95
+ border-radius: 4px;
96
+ font-size: 1rem;
97
+ min-width: 200px;
98
+ }
99
+
100
+ button {
101
+ background-color: var(--secondary-color);
102
+ color: white;
103
+ border: none;
104
+ padding: 0.8rem 1.5rem;
105
+ border-radius: 4px;
106
+ cursor: pointer;
107
+ font-size: 1rem;
108
+ transition: background-color 0.3s;
109
+ }
110
+
111
+ button:hover {
112
+ background-color: var(--accent-color);
113
+ }
114
+
115
+ .background-controls {
116
+ display: flex;
117
+ justify-content: center;
118
+ align-items: center;
119
+ gap: 1rem;
120
+ margin-top: 1.5rem;
121
+ }
122
+
123
+ .background-controls button {
124
+ width: 40px;
125
+ height: 40px;
126
+ display: flex;
127
+ align-items: center;
128
+ justify-content: center;
129
+ padding: 0;
130
+ }
131
+
132
+ select {
133
+ padding: 0.5rem;
134
+ border-radius: 4px;
135
+ border: 1px solid #ddd;
136
+ }
137
+
138
+ .poem-display {
139
+ background-color: rgba(255, 255, 255, 0.8);
140
+ padding: 2rem;
141
+ border-radius: 8px;
142
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
143
+ }
144
+
145
+ .poem-container {
146
+ background-color: white;
147
+ padding: 2rem;
148
+ border-radius: 4px;
149
+ border-left: 4px solid var(--primary-color);
150
+ min-height: 200px;
151
+ display: flex;
152
+ flex-direction: column;
153
+ justify-content: center;
154
+ }
155
+
156
+ .poem-text {
157
+ font-family: 'Playfair Display', serif;
158
+ font-size: 1.3rem;
159
+ line-height: 1.8;
160
+ margin-bottom: 1rem;
161
+ color: var(--dark-color);
162
+ }
163
+
164
+ .poem-author {
165
+ text-align: right;
166
+ font-style: italic;
167
+ color: var(--secondary-color);
168
+ }
169
+
170
+ .footer {
171
+ background-color: var(--dark-color);
172
+ color: var(--text-light);
173
+ text-align: center;
174
+ padding: 1rem;
175
+ margin-top: 2rem;
176
+ }
177
+
178
+ /* Background images */
179
+ .bg-autumn {
180
+ background-image: url('assets/images/bg-autumn.svg');
181
+ background-size: cover;
182
+ background-position: center;
183
+ }
184
+
185
+ .bg-stars {
186
+ background-image: url('assets/images/bg-stars.svg');
187
+ background-size: cover;
188
+ background-position: center;
189
+ }
190
+
191
+ .bg-hearts {
192
+ background-image: url('assets/images/bg-hearts.svg');
193
+ background-size: cover;
194
+ background-position: center;
195
+ }
196
+
197
+ /* Responsive design */
198
+ @media (max-width: 768px) {
199
+ .input-group {
200
+ flex-direction: column;
201
+ }
202
+
203
+ input[type="text"] {
204
+ min-width: auto;
205
+ }
206
+
207
+ .background-controls {
208
+ flex-wrap: wrap;
209
+ }
210
+
211
+ .poem-text {
212
+ font-size: 1.1rem;
213
+ }
214
+ }
215
+
216
+ @media (max-width: 480px) {
217
+ .header {
218
+ padding: 0.8rem;
219
+ }
220
+
221
+ .header-link {
222
+ position: static;
223
+ margin-top: 0.5rem;
224
+ }
225
+
226
+ .main-content {
227
+ padding: 1rem;
228
+ }
229
+
230
+ h1 {
231
+ font-size: 2rem;
232
+ }
233
+ }
234
+
235
+ .visually-hidden {
236
+ position: absolute;
237
+ width: 1px;
238
+ height: 1px;
239
+ padding: 0;
240
+ margin: -1px;
241
+ overflow: hidden;
242
+ clip: rect(0, 0, 0, 0);
243
+ white-space: nowrap;
244
+ border: 0;
245
+ }
assets/images/bg-autumn.svg ADDED
assets/images/bg-hearts.svg ADDED
assets/images/bg-stars.svg ADDED
assets/js/script.js ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Poem data
3
+ const poems = [
4
+ {
5
+ text: "In the quiet of the evening, under skies so wide, I find my heart beating close to yours, my love. The stars above whisper secrets of our bond, eternal as the night, deep as the ocean's song.",
6
+ keywords: ["evening", "love", "stars"]
7
+ },
8
+ {
9
+ text: "Autumn leaves dance in crimson and gold, mirroring the fire that burns within my soul. Each leaf that falls is a promise made, that in your arms is where I'll fade.",
10
+ keywords: ["autumn", "leaves", "fire"]
11
+ },
12
+ {
13
+ text: "Your eyes are the moonlight that guides me through the dark, your touch the spark that ignites the fire in my heart. In this vast universe, you are my constant star, my love, my life, no matter near or far.",
14
+ keywords: ["moon", "eyes", "universe"]
15
+ },
16
+ {
17
+ text: "Like the river finds the sea, my heart has found its way to thee. Through storm and sunshine, come what may, in your love I'll always stay.",
18
+ keywords: ["river", "sea", "love"]
19
+ },
20
+ {
21
+ text: "In the garden of your heart, I plant my love so true. With every beat it grows, a flower just for you. The petals soft as whispers, the scent so sweet and light, blooming in the sunshine of your love so bright.",
22
+ keywords: ["garden", "heart", "flower"]
23
+ }
24
+ ];
25
+
26
+ // DOM elements
27
+ const poemPrompt = document.getElementById('poem-prompt');
28
+ const generateBtn = document.getElementById('generate-btn');
29
+ const poemText = document.getElementById('poem-text');
30
+ const poemContainer = document.getElementById('poem-container');
31
+ const prevBgBtn = document.getElementById('prev-bg');
32
+ const nextBgBtn = document.getElementById('next-bg');
33
+ const bgSelect = document.getElementById('bg-select');
34
+
35
+ // Background images
36
+ const backgrounds = [
37
+ { id: 'autumn', path: 'assets/images/bg-autumn.svg' },
38
+ { id: 'stars', path: 'assets/images/bg-stars.svg' },
39
+ { id: 'hearts', path: 'assets/images/bg-hearts.svg' }
40
+ ];
41
+
42
+ let currentBgIndex = 0;
43
+
44
+ // Set initial background
45
+ updateBackground();
46
+
47
+ // Event listeners
48
+ generateBtn.addEventListener('click', generatePoem);
49
+ poemPrompt.addEventListener('keypress', function(e) {
50
+ if (e.key === 'Enter') {
51
+ generatePoem();
52
+ }
53
+ });
54
+
55
+ prevBgBtn.addEventListener('click', showPreviousBackground);
56
+ nextBgBtn.addEventListener('click', showNextBackground);
57
+ bgSelect.addEventListener('change', function() {
58
+ const selectedId = this.value;
59
+ const index = backgrounds.findIndex(bg => bg.id === selectedId);
60
+ if (index !== -1) {
61
+ currentBgIndex = index;
62
+ updateBackground();
63
+ }
64
+ });
65
+
66
+ // Functions
67
+ function generatePoem() {
68
+ const input = poemPrompt.value.toLowerCase();
69
+
70
+ // Simple filtering based on input keywords
71
+ let filteredPoems = poems;
72
+ if (input.trim()) {
73
+ const keywords = input.split(/\s+/);
74
+ filteredPoems = poems.filter(poem => {
75
+ return keywords.some(keyword =>
76
+ poem.keywords.some(kw => kw.includes(keyword))
77
+ );
78
+ });
79
+ }
80
+
81
+ // If no matching poems, use all poems
82
+ if (filteredPoems.length === 0) {
83
+ filteredPoems = poems;
84
+ }
85
+
86
+ // Select random poem
87
+ const randomIndex = Math.floor(Math.random() * filteredPoems.length);
88
+ const selectedPoem = filteredPoems[randomIndex];
89
+
90
+ // Display poem with animation
91
+ poemText.style.opacity = 0;
92
+ setTimeout(() => {
93
+ poemText.textContent = selectedPoem.text;
94
+ poemText.style.opacity = 1;
95
+
96
+ // Change background
97
+ showNextBackground();
98
+ }, 300);
99
+ }
100
+
101
+ function updateBackground() {
102
+ const currentBg = backgrounds[currentBgIndex];
103
+ document.body.style.backgroundImage = `url('${currentBg.path}')`;
104
+ bgSelect.value = currentBg.id;
105
+ }
106
+
107
+ function showNextBackground() {
108
+ currentBgIndex = (currentBgIndex + 1) % backgrounds.length;
109
+ updateBackground();
110
+ }
111
+
112
+ function showPreviousBackground() {
113
+ currentBgIndex = (currentBgIndex - 1 + backgrounds.length) % backgrounds.length;
114
+ updateBackground();
115
+ }
116
+ });
index.html CHANGED
@@ -1,19 +1,52 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </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
+ <meta name="description" content="Stellar Verse: Generate romantic poems with beautiful dynamic backgrounds. Express your feelings through poetry.">
7
+ <title>Stellar Verse - Romantic Poetry Generator</title>
8
+ <link rel="stylesheet" href="assets/css/styles.css">
9
+ <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Raleway:wght@300;400;600&display=swap" rel="stylesheet">
10
+ </head>
11
+ <body>
12
+ <header class="header">
13
+ <h1>Stellar Verse</h1>
14
+ <div class="header-link">
15
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" rel="noopener noreferrer">Built with anycoder</a>
16
+ </div>
17
+ </header>
18
+
19
+ <main class="main-content">
20
+ <section class="poem-generator">
21
+ <h2>Generate Your Romantic Poem</h2>
22
+ <div class="input-group">
23
+ <label for="poem-prompt" class="visually-hidden">Enter themes or keywords for your poem</label>
24
+ <input type="text" id="poem-prompt" placeholder="Enter themes (love, moon, heart...)">
25
+ <button id="generate-btn" aria-label="Generate poem">Generate Poem</button>
26
+ </div>
27
+ <div class="background-controls">
28
+ <button id="prev-bg" aria-label="Previous background">≺</button>
29
+ <button id="next-bg" aria-label="Next background">≻</button>
30
+ <select id="bg-select" aria-label="Select background">
31
+ <option value="autumn">Autumn Leaves</option>
32
+ <option value="stars">Starry Night</option>
33
+ <option value="hearts">Romantic Hearts</option>
34
+ </select>
35
+ </div>
36
+ </section>
37
+
38
+ <section class="poem-display">
39
+ <div class="poem-container" id="poem-container">
40
+ <p class="poem-text" id="poem-text">Your romantic poem will appear here...</p>
41
+ <div class="poem-author">— Stellar Verse</div>
42
+ </div>
43
+ </section>
44
+ </main>
45
+
46
+ <footer class="footer">
47
+ <p>&copy; 2023 Stellar Verse. All rights reserved.</p>
48
+ </footer>
49
+
50
+ <script src="assets/js/script.js"></script>
51
+ </body>
52
+ </html>