tomdecolita commited on
Commit
be36592
·
verified ·
1 Parent(s): 5d875b3

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +304 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Rapgen
3
- emoji: 🔥
4
- colorFrom: blue
5
  colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: rapgen
3
+ emoji: 🐳
4
+ colorFrom: purple
5
  colorTo: pink
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,304 @@
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
+ <title>Rap Lyric Generator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
11
+ body {
12
+ font-family: 'Poppins', sans-serif;
13
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
14
+ min-height: 100vh;
15
+ }
16
+ .gradient-text {
17
+ background: linear-gradient(90deg, #f72585, #7209b7, #3a0ca3);
18
+ -webkit-background-clip: text;
19
+ background-clip: text;
20
+ color: transparent;
21
+ }
22
+ .rap-line {
23
+ line-height: 1.8;
24
+ position: relative;
25
+ padding-left: 1.5rem;
26
+ }
27
+ .rap-line::before {
28
+ content: "♪";
29
+ position: absolute;
30
+ left: 0;
31
+ color: rgba(255,255,255,0.3);
32
+ }
33
+ .beat-pulse {
34
+ animation: pulse 0.5s infinite alternate;
35
+ }
36
+ @keyframes pulse {
37
+ from { transform: scale(1); }
38
+ to { transform: scale(1.05); }
39
+ }
40
+ .typewriter {
41
+ overflow: hidden;
42
+ border-right: .15em solid #f72585;
43
+ white-space: nowrap;
44
+ animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
45
+ }
46
+ @keyframes typing {
47
+ from { width: 0 }
48
+ to { width: 100% }
49
+ }
50
+ @keyframes blink-caret {
51
+ from, to { border-color: transparent }
52
+ 50% { border-color: #f72585; }
53
+ }
54
+ </style>
55
+ </head>
56
+ <body class="text-white">
57
+ <div class="container mx-auto px-4 py-12 max-w-4xl">
58
+ <header class="text-center mb-12">
59
+ <h1 class="text-5xl font-bold mb-2 gradient-text">Rap Verse Generator</h1>
60
+ <p class="text-xl text-gray-300">Drop a word, get a fire verse</p>
61
+ </header>
62
+
63
+ <div class="bg-gray-800 bg-opacity-50 rounded-xl p-8 backdrop-blur-sm border border-gray-700 shadow-2xl">
64
+ <div class="flex flex-col md:flex-row gap-6 mb-8">
65
+ <div class="flex-1">
66
+ <label for="seed-word" class="block text-lg font-medium mb-2 text-pink-400">Your Inspiration Word</label>
67
+ <div class="relative">
68
+ <input type="text" id="seed-word" placeholder="e.g. 'money', 'hustle', 'dreams'"
69
+ class="w-full px-4 py-3 bg-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500 text-white placeholder-gray-400">
70
+ <button id="generate-btn" class="absolute right-2 top-1/2 transform -translate-y-1/2 bg-pink-600 hover:bg-pink-700 text-white px-4 py-1 rounded-lg transition-all duration-300 flex items-center">
71
+ <i class="fas fa-bolt mr-2"></i> Generate
72
+ </button>
73
+ </div>
74
+ </div>
75
+ <div class="flex-1">
76
+ <label for="style-select" class="block text-lg font-medium mb-2 text-purple-400">Rapper Style</label>
77
+ <select id="style-select" class="w-full px-4 py-3 bg-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-white">
78
+ <option value="old-school">Old School</option>
79
+ <option value="trap">Trap</option>
80
+ <option value="conscious">Conscious</option>
81
+ <option value="gangsta">Gangsta</option>
82
+ <option value="mumble">Mumble</option>
83
+ </select>
84
+ </div>
85
+ </div>
86
+
87
+ <div id="loading" class="hidden text-center py-8">
88
+ <div class="inline-block text-pink-500 text-4xl mb-4 beat-pulse">
89
+ <i class="fas fa-compact-disc"></i>
90
+ </div>
91
+ <p class="text-gray-300">Cooking up some fire lyrics...</p>
92
+ </div>
93
+
94
+ <div id="result" class="hidden bg-gray-900 rounded-lg p-6 border border-gray-700 shadow-inner">
95
+ <div class="flex justify-between items-center mb-4">
96
+ <h3 class="text-xl font-bold text-pink-400">Your Rap Verse</h3>
97
+ <button id="copy-btn" class="text-gray-400 hover:text-white transition-colors">
98
+ <i class="fas fa-copy"></i> Copy
99
+ </button>
100
+ </div>
101
+ <div id="lyrics-output" class="space-y-3 text-gray-200">
102
+ <!-- Lyrics will appear here -->
103
+ </div>
104
+ <div class="mt-6 pt-4 border-t border-gray-700 flex justify-end">
105
+ <button id="new-verse-btn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg transition-all duration-300 flex items-center">
106
+ <i class="fas fa-redo mr-2"></i> New Verse
107
+ </button>
108
+ </div>
109
+ </div>
110
+
111
+ <div id="placeholder" class="text-center py-12 text-gray-500">
112
+ <div class="text-5xl mb-4">
113
+ <i class="fas fa-microphone-alt"></i>
114
+ </div>
115
+ <h3 class="text-xl mb-2">Ready to Create</h3>
116
+ <p>Enter a word above and generate your custom rap lyrics</p>
117
+ </div>
118
+ </div>
119
+
120
+ <footer class="mt-12 text-center text-gray-500 text-sm">
121
+ <p>Made with <i class="fas fa-heart text-pink-500"></i> for hip-hop heads</p>
122
+ </footer>
123
+ </div>
124
+
125
+ <script>
126
+ document.addEventListener('DOMContentLoaded', function() {
127
+ const generateBtn = document.getElementById('generate-btn');
128
+ const seedWordInput = document.getElementById('seed-word');
129
+ const styleSelect = document.getElementById('style-select');
130
+ const loadingElement = document.getElementById('loading');
131
+ const resultElement = document.getElementById('result');
132
+ const placeholderElement = document.getElementById('placeholder');
133
+ const lyricsOutput = document.getElementById('lyrics-output');
134
+ const copyBtn = document.getElementById('copy-btn');
135
+ const newVerseBtn = document.getElementById('new-verse-btn');
136
+
137
+ // Rhyme dictionaries for different styles
138
+ const rhymeDict = {
139
+ 'old-school': {
140
+ rhymes: ['flow', 'show', 'grow', 'know', 'slow', 'throw', 'glow', 'snow'],
141
+ patterns: [
142
+ "I'm the {adjective} {noun} with the {noun} to {verb}",
143
+ "From the {place} to the {place}, I {verb} with {noun}",
144
+ "{adjective} {noun} in the {place}, {verb}ing all day",
145
+ "I {verb}, I {verb}, with my {noun} so {adjective}",
146
+ "{noun} so {adjective}, make the {noun} {verb}"
147
+ ]
148
+ },
149
+ 'trap': {
150
+ rhymes: ['drip', 'flip', 'whip', 'clip', 'ship', 'trip', 'skip', 'dip'],
151
+ patterns: [
152
+ "{adjective} {noun} on my {noun}, yeah I {verb}",
153
+ "{verb}ing in the {place} with my {noun} so {adjective}",
154
+ "{noun} {noun} {verb}, {adjective} {noun} flex",
155
+ "I got {noun}, I got {noun}, {verb}ing on the {place}",
156
+ "{adjective} {adjective}, {verb} with the {noun}"
157
+ ]
158
+ },
159
+ 'conscious': {
160
+ rhymes: ['mind', 'find', 'grind', 'bind', 'kind', 'signed', 'blind', 'refined'],
161
+ patterns: [
162
+ "The {noun} of the {place} makes the {noun} {verb}",
163
+ "We {verb} for the {noun}, we {verb} for the {place}",
164
+ "{adjective} {noun} in a world so {adjective}",
165
+ "The {place} {verb}s while the {noun} {verb}s",
166
+ "{verb} the {noun}, {verb} the {place}"
167
+ ]
168
+ },
169
+ 'gangsta': {
170
+ rhymes: ['heat', 'street', 'beat', 'treat', 'seat', 'meet', 'cheat', 'repeat'],
171
+ patterns: [
172
+ "{noun} in my {noun}, {verb}ing on the {place}",
173
+ "{adjective} {noun} make the {noun} {verb}",
174
+ "From the {place} to the {place}, {verb} with {noun}",
175
+ "{verb} the {noun}, {adjective} {noun} flex",
176
+ "{noun} so {adjective}, make the {place} {verb}"
177
+ ]
178
+ },
179
+ 'mumble': {
180
+ rhymes: ['skrrt', 'blurp', 'yeah', 'uh', 'ayy', 'ooh', 'wow', 'pow'],
181
+ patterns: [
182
+ "{adjective} {noun} {noun} {verb} skrrt",
183
+ "{verb} {verb} on the {noun} yeah yeah",
184
+ "{noun} {noun} {adjective} {verb} uh",
185
+ "{adjective} {adjective} {noun} {verb} ayy",
186
+ "{verb}ing with my {noun} ooh"
187
+ ]
188
+ }
189
+ };
190
+
191
+ // Word banks
192
+ const adjectives = ["dope", "fresh", "icy", "savage", "lit", "fire", "cold", "smooth", "raw", "real"];
193
+ const nouns = ["mic", "flow", "chain", "whip", "dream", "game", "hustle", "grind", "paper", "hood"];
194
+ const verbs = ["drop", "rock", "pop", "stop", "cop", "flip", "drip", "rip", "skip", "trip"];
195
+ const places = ["streets", "trap", "studio", "block", "hood", "spot", "yard", "crib", "lane", "city"];
196
+
197
+ // Generate lyrics
198
+ generateBtn.addEventListener('click', generateLyrics);
199
+ seedWordInput.addEventListener('keypress', function(e) {
200
+ if (e.key === 'Enter') generateLyrics();
201
+ });
202
+ newVerseBtn.addEventListener('click', generateLyrics);
203
+
204
+ function generateLyrics() {
205
+ const seedWord = seedWordInput.value.trim();
206
+ if (!seedWord) {
207
+ alert("Please enter a word to generate lyrics!");
208
+ return;
209
+ }
210
+
211
+ const style = styleSelect.value;
212
+ const styleData = rhymeDict[style];
213
+
214
+ // Show loading state
215
+ placeholderElement.classList.add('hidden');
216
+ loadingElement.classList.remove('hidden');
217
+ resultElement.classList.add('hidden');
218
+
219
+ // Simulate processing delay
220
+ setTimeout(() => {
221
+ loadingElement.classList.add('hidden');
222
+ resultElement.classList.remove('hidden');
223
+ displayLyrics(seedWord, styleData);
224
+ }, 1500);
225
+ }
226
+
227
+ function displayLyrics(seedWord, styleData) {
228
+ lyricsOutput.innerHTML = '';
229
+
230
+ // Generate 8-12 lines
231
+ const lineCount = 8 + Math.floor(Math.random() * 5);
232
+ let rhymeWord = styleData.rhymes[Math.floor(Math.random() * styleData.rhymes.length)];
233
+
234
+ // Create intro line with seed word
235
+ const introLine = createLine(seedWord, styleData, true);
236
+ addLineToOutput(introLine);
237
+
238
+ // Create main verse lines
239
+ for (let i = 0; i < lineCount - 2; i++) {
240
+ const shouldRhyme = i % 2 === 0; // Every other line rhymes
241
+ const line = createLine(seedWord, styleData, shouldRhyme, rhymeWord);
242
+ addLineToOutput(line);
243
+ }
244
+
245
+ // Create outro line that rhymes
246
+ const outroLine = createLine(seedWord, styleData, true, rhymeWord);
247
+ addLineToOutput(outroLine);
248
+ }
249
+
250
+ function createLine(seedWord, styleData, shouldRhyme, rhymeWord) {
251
+ const pattern = styleData.patterns[Math.floor(Math.random() * styleData.patterns.length)];
252
+
253
+ // Replace placeholders with random words
254
+ let line = pattern
255
+ .replace(/\{adjective\}/g, () => adjectives[Math.floor(Math.random() * adjectives.length)])
256
+ .replace(/\{noun\}/g, () => nouns[Math.floor(Math.random() * nouns.length)])
257
+ .replace(/\{verb\}/g, () => verbs[Math.floor(Math.random() * verbs.length)])
258
+ .replace(/\{place\}/g, () => places[Math.floor(Math.random() * places.length)]);
259
+
260
+ // Insert seed word randomly
261
+ const insertPos = Math.floor(Math.random() * line.split(' ').length);
262
+ const words = line.split(' ');
263
+ words.splice(insertPos, 0, seedWord);
264
+ line = words.join(' ');
265
+
266
+ // Force rhyme if needed
267
+ if (shouldRhyme && rhymeWord) {
268
+ const words = line.split(' ');
269
+ words[words.length - 1] = rhymeWord;
270
+ line = words.join(' ');
271
+ }
272
+
273
+ return capitalizeFirstLetter(line);
274
+ }
275
+
276
+ function addLineToOutput(line) {
277
+ const lineElement = document.createElement('p');
278
+ lineElement.className = 'rap-line';
279
+ lineElement.textContent = line;
280
+ lyricsOutput.appendChild(lineElement);
281
+ }
282
+
283
+ function capitalizeFirstLetter(string) {
284
+ return string.charAt(0).toUpperCase() + string.slice(1);
285
+ }
286
+
287
+ // Copy functionality
288
+ copyBtn.addEventListener('click', function() {
289
+ const lyrics = Array.from(lyricsOutput.children)
290
+ .map(line => line.textContent)
291
+ .join('\n');
292
+
293
+ navigator.clipboard.writeText(lyrics).then(() => {
294
+ const originalIcon = copyBtn.innerHTML;
295
+ copyBtn.innerHTML = '<i class="fas fa-check"></i> Copied!';
296
+ setTimeout(() => {
297
+ copyBtn.innerHTML = originalIcon;
298
+ }, 2000);
299
+ });
300
+ });
301
+ });
302
+ </script>
303
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=tomdecolita/rapgen" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
304
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Create a website rap lyrics generator. Write a single word and use the word to generate an entire lyric for a rapper. Adjust the flow