Kostya5605 commited on
Commit
cb4fb84
·
verified ·
1 Parent(s): 16c4e0b

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +363 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Luna With Ai
3
- emoji: 💻
4
- colorFrom: indigo
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: luna-with-ai
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: purple
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,363 @@
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>AI Companion - 2D Virtual Girl</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
+ @keyframes float {
11
+ 0%, 100% { transform: translateY(0); }
12
+ 50% { transform: translateY(-10px); }
13
+ }
14
+ @keyframes blink {
15
+ 0%, 100% { height: 20px; }
16
+ 50% { height: 5px; }
17
+ }
18
+ .character {
19
+ animation: float 3s ease-in-out infinite;
20
+ }
21
+ .eye {
22
+ animation: blink 3s infinite;
23
+ }
24
+ .chat-bubble {
25
+ border-radius: 20px;
26
+ position: relative;
27
+ opacity: 0;
28
+ transform: translateY(10px);
29
+ transition: all 0.3s ease;
30
+ }
31
+ .chat-bubble.visible {
32
+ opacity: 1;
33
+ transform: translateY(0);
34
+ }
35
+ .typing-indicator span {
36
+ display: inline-block;
37
+ width: 8px;
38
+ height: 8px;
39
+ background-color: #666;
40
+ border-radius: 50%;
41
+ margin: 0 2px;
42
+ animation: bounce 1.4s infinite ease-in-out;
43
+ }
44
+ .typing-indicator span:nth-child(2) {
45
+ animation-delay: 0.2s;
46
+ }
47
+ .typing-indicator span:nth-child(3) {
48
+ animation-delay: 0.4s;
49
+ }
50
+ @keyframes bounce {
51
+ 0%, 100% { transform: translateY(0); }
52
+ 50% { transform: translateY(-5px); }
53
+ }
54
+ .mood-happy {
55
+ filter: hue-rotate(-20deg) brightness(1.1);
56
+ }
57
+ .mood-sad {
58
+ filter: hue-rotate(40deg) brightness(0.9);
59
+ }
60
+ .mood-angry {
61
+ filter: hue-rotate(-60deg) brightness(1.2);
62
+ }
63
+ .mood-neutral {
64
+ filter: none;
65
+ }
66
+ </style>
67
+ </head>
68
+ <body class="bg-gradient-to-b from-indigo-100 to-purple-100 min-h-screen flex flex-col items-center justify-center p-4">
69
+ <div class="max-w-4xl w-full bg-white rounded-3xl shadow-xl overflow-hidden">
70
+ <div class="flex flex-col md:flex-row h-full">
71
+ <!-- Character Panel -->
72
+ <div class="w-full md:w-1/3 bg-gradient-to-b from-pink-100 to-purple-200 p-6 flex flex-col items-center justify-center">
73
+ <div class="character relative mb-6" id="character">
74
+ <!-- Head -->
75
+ <div class="w-48 h-48 bg-pink-200 rounded-full relative">
76
+ <!-- Eyes -->
77
+ <div class="absolute top-16 left-10 w-8 h-8 bg-white rounded-full flex justify-center items-center">
78
+ <div class="eye w-6 h-6 bg-blue-500 rounded-full relative overflow-hidden">
79
+ <div class="absolute w-3 h-3 bg-black rounded-full top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"></div>
80
+ </div>
81
+ </div>
82
+ <div class="absolute top-16 right-10 w-8 h-8 bg-white rounded-full flex justify-center items-center">
83
+ <div class="eye w-6 h-6 bg-blue-500 rounded-full relative overflow-hidden">
84
+ <div class="absolute w-3 h-3 bg-black rounded-full top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"></div>
85
+ </div>
86
+ </div>
87
+ <!-- Mouth -->
88
+ <div class="absolute bottom-12 left-1/2 transform -translate-x-1/2 w-16 h-8 bg-pink-300 rounded-b-full" id="mouth"></div>
89
+ <!-- Blush -->
90
+ <div class="absolute bottom-16 left-6 w-6 h-3 bg-pink-300 opacity-60 rounded-full"></div>
91
+ <div class="absolute bottom-16 right-6 w-6 h-3 bg-pink-300 opacity-60 rounded-full"></div>
92
+ </div>
93
+ <!-- Body -->
94
+ <div class="w-32 h-40 bg-pink-100 rounded-t-full mt-4 relative">
95
+ <!-- Arms -->
96
+ <div class="absolute -left-8 top-8 w-16 h-6 bg-pink-100 rounded-full transform -rotate-45"></div>
97
+ <div class="absolute -right-8 top-8 w-16 h-6 bg-pink-100 rounded-full transform rotate-45"></div>
98
+ </div>
99
+ </div>
100
+
101
+ <div class="text-center">
102
+ <h2 class="text-2xl font-bold text-purple-800">Luna</h2>
103
+ <p class="text-purple-600">Your AI Companion</p>
104
+ <div class="mt-4 flex justify-center space-x-2">
105
+ <button class="mood-btn bg-blue-100 text-blue-800 p-2 rounded-full" data-mood="happy">
106
+ <i class="fas fa-smile"></i>
107
+ </button>
108
+ <button class="mood-btn bg-yellow-100 text-yellow-800 p-2 rounded-full" data-mood="sad">
109
+ <i class="fas fa-sad-tear"></i>
110
+ </button>
111
+ <button class="mood-btn bg-red-100 text-red-800 p-2 rounded-full" data-mood="angry">
112
+ <i class="fas fa-angry"></i>
113
+ </button>
114
+ <button class="mood-btn bg-gray-100 text-gray-800 p-2 rounded-full" data-mood="neutral">
115
+ <i class="fas fa-meh"></i>
116
+ </button>
117
+ </div>
118
+ </div>
119
+
120
+ <div class="mt-6 w-full">
121
+ <div class="bg-white bg-opacity-70 rounded-xl p-4">
122
+ <h3 class="font-semibold text-purple-700">Personality</h3>
123
+ <div class="flex flex-wrap gap-2 mt-2">
124
+ <span class="bg-purple-100 text-purple-800 px-2 py-1 rounded-full text-xs">Friendly</span>
125
+ <span class="bg-pink-100 text-pink-800 px-2 py-1 rounded-full text-xs">Curious</span>
126
+ <span class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs">Playful</span>
127
+ <span class="bg-green-100 text-green-800 px-2 py-1 rounded-full text-xs">Supportive</span>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </div>
132
+
133
+ <!-- Chat Panel -->
134
+ <div class="w-full md:w-2/3 p-6 flex flex-col">
135
+ <div class="flex items-center mb-6">
136
+ <div class="w-10 h-10 bg-pink-200 rounded-full flex items-center justify-center mr-3">
137
+ <i class="fas fa-robot text-purple-700"></i>
138
+ </div>
139
+ <div>
140
+ <h2 class="font-bold text-purple-800">Chat with Luna</h2>
141
+ <p class="text-xs text-gray-500">AI-powered virtual companion</p>
142
+ </div>
143
+ </div>
144
+
145
+ <div class="flex-1 overflow-y-auto mb-4 space-y-4" id="chat-container">
146
+ <!-- Initial greeting -->
147
+ <div class="chat-bubble visible">
148
+ <div class="bg-purple-100 text-purple-900 p-4 rounded-2xl rounded-tl-none max-w-xs">
149
+ <p>Hello! I'm Luna, your AI companion. How can I brighten your day today? 💖</p>
150
+ </div>
151
+ </div>
152
+ </div>
153
+
154
+ <div class="mt-auto">
155
+ <div class="relative">
156
+ <textarea id="user-input" class="w-full p-4 pr-12 border border-purple-200 rounded-2xl focus:outline-none focus:ring-2 focus:ring-purple-300 resize-none" placeholder="Type your message..." rows="2"></textarea>
157
+ <button id="send-btn" class="absolute right-3 bottom-3 bg-purple-600 text-white p-2 rounded-full hover:bg-purple-700 transition">
158
+ <i class="fas fa-paper-plane"></i>
159
+ </button>
160
+ </div>
161
+ <div class="flex justify-between items-center mt-2 text-xs text-gray-500">
162
+ <div>
163
+ <button id="voice-btn" class="mr-2 text-purple-600 hover:text-purple-800">
164
+ <i class="fas fa-microphone"></i>
165
+ </button>
166
+ <button id="clear-btn" class="text-gray-500 hover:text-gray-700">
167
+ <i class="fas fa-trash-alt"></i> Clear chat
168
+ </button>
169
+ </div>
170
+ <div id="typing-indicator" class="typing-indicator hidden">
171
+ <span></span>
172
+ <span></span>
173
+ <span></span>
174
+ </div>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ </div>
179
+ </div>
180
+
181
+ <script>
182
+ document.addEventListener('DOMContentLoaded', function() {
183
+ const chatContainer = document.getElementById('chat-container');
184
+ const userInput = document.getElementById('user-input');
185
+ const sendBtn = document.getElementById('send-btn');
186
+ const voiceBtn = document.getElementById('voice-btn');
187
+ const clearBtn = document.getElementById('clear-btn');
188
+ const typingIndicator = document.getElementById('typing-indicator');
189
+ const character = document.getElementById('character');
190
+ const mouth = document.getElementById('mouth');
191
+
192
+ let currentMood = 'happy';
193
+
194
+ // Sample responses based on mood and input
195
+ const responses = {
196
+ greeting: [
197
+ "Hello there! How are you feeling today?",
198
+ "Hi! It's nice to meet you. What's on your mind?",
199
+ "Hey! I'm here to chat whenever you need me."
200
+ ],
201
+ question: [
202
+ "That's an interesting question! Let me think...",
203
+ "Hmm, I'd say it depends on the situation.",
204
+ "I'm not entirely sure, but here's what I think."
205
+ ],
206
+ compliment: [
207
+ "Aww, you're making me blush! Thank you!",
208
+ "That's so sweet of you to say!",
209
+ "You're too kind! I appreciate it."
210
+ ],
211
+ sad: [
212
+ "I'm sorry to hear that. Would you like to talk about it?",
213
+ "It's okay to feel that way. I'm here for you.",
214
+ "Sending you virtual hugs. Things will get better."
215
+ ],
216
+ happy: [
217
+ "That's wonderful! I'm happy for you!",
218
+ "Yay! That's great news!",
219
+ "Your happiness makes me happy too!"
220
+ ],
221
+ confused: [
222
+ "I'm not sure I understand. Could you explain more?",
223
+ "Hmm, I might need more context to help with that.",
224
+ "Let me think about that for a moment..."
225
+ ],
226
+ default: [
227
+ "Tell me more about that.",
228
+ "That's interesting! What else?",
229
+ "I'd love to hear more about your thoughts on this."
230
+ ]
231
+ };
232
+
233
+ // Mood buttons
234
+ document.querySelectorAll('.mood-btn').forEach(btn => {
235
+ btn.addEventListener('click', function() {
236
+ currentMood = this.dataset.mood;
237
+ updateCharacterMood();
238
+ });
239
+ });
240
+
241
+ // Update character appearance based on mood
242
+ function updateCharacterMood() {
243
+ character.className = 'character relative mb-6';
244
+ character.classList.add(`mood-${currentMood}`);
245
+
246
+ // Change mouth shape based on mood
247
+ switch(currentMood) {
248
+ case 'happy':
249
+ mouth.className = 'absolute bottom-12 left-1/2 transform -translate-x-1/2 w-16 h-8 bg-pink-300 rounded-b-full';
250
+ break;
251
+ case 'sad':
252
+ mouth.className = 'absolute bottom-16 left-1/2 transform -translate-x-1/2 w-16 h-4 bg-pink-300 rounded-t-full';
253
+ break;
254
+ case 'angry':
255
+ mouth.className = 'absolute bottom-14 left-1/2 transform -translate-x-1/2 w-16 h-2 bg-pink-300';
256
+ break;
257
+ default:
258
+ mouth.className = 'absolute bottom-12 left-1/2 transform -translate-x-1/2 w-12 h-4 bg-pink-300';
259
+ }
260
+ }
261
+
262
+ // Send message function
263
+ function sendMessage() {
264
+ const message = userInput.value.trim();
265
+ if (message === '') return;
266
+
267
+ // Add user message to chat
268
+ addMessageToChat(message, 'user');
269
+ userInput.value = '';
270
+
271
+ // Show typing indicator
272
+ typingIndicator.classList.remove('hidden');
273
+
274
+ // Simulate AI thinking time
275
+ setTimeout(() => {
276
+ typingIndicator.classList.add('hidden');
277
+ const aiResponse = generateAIResponse(message);
278
+ addMessageToChat(aiResponse, 'ai');
279
+
280
+ // Scroll to bottom
281
+ chatContainer.scrollTop = chatContainer.scrollHeight;
282
+ }, 1000 + Math.random() * 2000);
283
+ }
284
+
285
+ // Add message to chat container
286
+ function addMessageToChat(message, sender) {
287
+ const bubble = document.createElement('div');
288
+ bubble.className = 'chat-bubble';
289
+
290
+ const content = document.createElement('div');
291
+ content.className = sender === 'user'
292
+ ? 'bg-purple-600 text-white p-4 rounded-2xl rounded-tr-none ml-auto max-w-xs'
293
+ : 'bg-purple-100 text-purple-900 p-4 rounded-2xl rounded-tl-none max-w-xs';
294
+
295
+ content.textContent = message;
296
+ bubble.appendChild(content);
297
+ chatContainer.appendChild(bubble);
298
+
299
+ // Make bubble visible with animation
300
+ setTimeout(() => {
301
+ bubble.classList.add('visible');
302
+ }, 10);
303
+
304
+ // Scroll to bottom
305
+ chatContainer.scrollTop = chatContainer.scrollHeight;
306
+ }
307
+
308
+ // Generate AI response based on input
309
+ function generateAIResponse(input) {
310
+ input = input.toLowerCase();
311
+
312
+ // Determine response category
313
+ let category = 'default';
314
+
315
+ if (input.includes('?') || input.includes('what') || input.includes('how') || input.includes('why')) {
316
+ category = 'question';
317
+ } else if (input.includes('hi') || input.includes('hello') || input.includes('hey')) {
318
+ category = 'greeting';
319
+ } else if (input.includes('love') || input.includes('like') || input.includes('cute') || input.includes('nice')) {
320
+ category = 'compliment';
321
+ } else if (input.includes('sad') || input.includes('upset') || input.includes('depressed') || input.includes('unhappy')) {
322
+ category = 'sad';
323
+ } else if (input.includes('happy') || input.includes('joy') || input.includes('excited') || input.includes('great')) {
324
+ category = 'happy';
325
+ } else if (input.includes('confused') || input.includes('dont know') || input.includes('understand')) {
326
+ category = 'confused';
327
+ }
328
+
329
+ // Get random response from selected category
330
+ const possibleResponses = responses[category] || responses['default'];
331
+ const randomIndex = Math.floor(Math.random() * possibleResponses.length);
332
+
333
+ return possibleResponses[randomIndex];
334
+ }
335
+
336
+ // Event listeners
337
+ sendBtn.addEventListener('click', sendMessage);
338
+
339
+ userInput.addEventListener('keypress', function(e) {
340
+ if (e.key === 'Enter' && !e.shiftKey) {
341
+ e.preventDefault();
342
+ sendMessage();
343
+ }
344
+ });
345
+
346
+ voiceBtn.addEventListener('click', function() {
347
+ alert('Voice input would be implemented here in a real application!');
348
+ });
349
+
350
+ clearBtn.addEventListener('click', function() {
351
+ if (confirm('Are you sure you want to clear the chat?')) {
352
+ chatContainer.innerHTML = '';
353
+ // Add initial greeting back
354
+ addMessageToChat("Hello again! What would you like to talk about now?", 'ai');
355
+ }
356
+ });
357
+
358
+ // Initial mood
359
+ updateCharacterMood();
360
+ });
361
+ </script>
362
+ <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=Kostya5605/luna-with-ai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
363
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Ai girl, разговаривает с тобой, 2д, взаимодействие с ней, генерация ответов с помощью ии