nomadicsynth commited on
Commit
4fee2f9
·
verified ·
1 Parent(s): 28e0b20

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +275 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Neurodivergent Translator
3
- emoji: 🏃
4
- colorFrom: red
5
- colorTo: indigo
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: neurodivergent-translator
3
+ emoji: 🐳
4
+ colorFrom: purple
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,275 @@
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>Neurodivergent Translator</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
+ <script>
10
+ tailwind.config = {
11
+ theme: {
12
+ extend: {
13
+ colors: {
14
+ primary: {
15
+ 50: '#f0f9ff',
16
+ 100: '#e0f2fe',
17
+ 200: '#bae6fd',
18
+ 300: '#7dd3fc',
19
+ 400: '#38bdf8',
20
+ 500: '#0ea5e9',
21
+ 600: '#0284c7',
22
+ 700: '#0369a1',
23
+ 800: '#075985',
24
+ 900: '#0c4a6e',
25
+ },
26
+ secondary: {
27
+ 50: '#f5f3ff',
28
+ 100: '#ede9fe',
29
+ 200: '#ddd6fe',
30
+ 300: '#c4b5fd',
31
+ 400: '#a78bfa',
32
+ 500: '#8b5cf6',
33
+ 600: '#7c3aed',
34
+ 700: '#6d28d9',
35
+ 800: '#5b21b6',
36
+ 900: '#4c1d95',
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ </script>
43
+ <style>
44
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
45
+
46
+ body {
47
+ font-family: 'Inter', sans-serif;
48
+ background-color: #f8fafc;
49
+ }
50
+
51
+ .input-box {
52
+ transition: all 0.2s ease;
53
+ min-height: 120px;
54
+ }
55
+
56
+ .input-box:focus {
57
+ border-color: #7dd3fc;
58
+ box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.3);
59
+ }
60
+
61
+ .output-bubble {
62
+ position: relative;
63
+ background-color: #f0f9ff;
64
+ border-radius: 18px;
65
+ }
66
+
67
+ .output-bubble:after {
68
+ content: '';
69
+ position: absolute;
70
+ left: 0;
71
+ top: -10px;
72
+ width: 0;
73
+ height: 0;
74
+ border: 10px solid transparent;
75
+ border-right-color: #f0f9ff;
76
+ border-left: 0;
77
+ margin-left: 20px;
78
+ }
79
+
80
+ .btn-primary {
81
+ transition: all 0.2s ease;
82
+ }
83
+
84
+ .btn-primary:hover {
85
+ transform: translateY(-1px);
86
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
87
+ }
88
+
89
+ .btn-primary:active {
90
+ transform: translateY(0);
91
+ }
92
+
93
+ .feedback-textarea {
94
+ min-height: 80px;
95
+ transition: all 0.2s ease;
96
+ }
97
+
98
+ .feedback-textarea:focus {
99
+ border-color: #c4b5fd;
100
+ box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.3);
101
+ }
102
+
103
+ @media (max-width: 640px) {
104
+ .container-padding {
105
+ padding-left: 1rem;
106
+ padding-right: 1rem;
107
+ }
108
+ }
109
+ </style>
110
+ </head>
111
+ <body class="min-h-screen bg-gray-50">
112
+ <div class="max-w-2xl mx-auto container-padding py-8 px-4 sm:px-6 lg:px-8">
113
+ <div class="text-center mb-8">
114
+ <div class="flex items-center justify-center mb-4">
115
+ <div class="bg-primary-100 p-3 rounded-full">
116
+ <i class="fas fa-brain text-primary-600 text-2xl"></i>
117
+ </div>
118
+ </div>
119
+ <h1 class="text-3xl font-bold text-gray-800 mb-2">Neurodivergent Translator</h1>
120
+ <p class="text-gray-600 max-w-md mx-auto">Bridge communication gaps with tailored message transformations</p>
121
+ </div>
122
+
123
+ <div class="bg-white rounded-xl shadow-sm p-6 mb-6">
124
+ <div class="mb-6">
125
+ <label for="original-message" class="block text-sm font-medium text-gray-700 mb-2">
126
+ Your original message
127
+ </label>
128
+ <textarea
129
+ id="original-message"
130
+ class="input-box w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200"
131
+ placeholder="Type or paste your message here..."
132
+ rows="4"></textarea>
133
+ </div>
134
+
135
+ <div class="mb-6">
136
+ <label for="transformation-type" class="block text-sm font-medium text-gray-700 mb-2">
137
+ Transformation Type
138
+ </label>
139
+ <select
140
+ id="transformation-type"
141
+ class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200">
142
+ <option value="clarify">Clarify my intent</option>
143
+ <option value="decode">Decode this message</option>
144
+ <option value="professional">Make it sound professional</option>
145
+ <option value="soften">Soften tone, keep meaning</option>
146
+ <option value="meltdown">I'm melting down, fix it</option>
147
+ </select>
148
+ </div>
149
+
150
+ <button
151
+ id="translate-btn"
152
+ class="btn-primary w-full bg-primary-500 hover:bg-primary-600 text-white font-medium py-3 px-4 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200 focus:ring-offset-2">
153
+ <i class="fas fa-language mr-2"></i> Translate
154
+ </button>
155
+ </div>
156
+
157
+ <div id="output-section" class="hidden bg-white rounded-xl shadow-sm p-6 mb-6">
158
+ <h2 class="text-lg font-medium text-gray-800 mb-4">Translated Message</h2>
159
+ <div class="output-bubble p-4 mb-6">
160
+ <p id="translated-output" class="text-gray-700"></p>
161
+ </div>
162
+
163
+ <div class="pt-4 border-t border-gray-100">
164
+ <h3 class="text-sm font-medium text-gray-700 mb-3">How helpful was this?</h3>
165
+ <textarea
166
+ id="feedback-text"
167
+ class="feedback-textarea w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-secondary-200"
168
+ placeholder="Your feedback helps us improve..."></textarea>
169
+ <button
170
+ id="feedback-btn"
171
+ class="mt-3 w-full bg-secondary-500 hover:bg-secondary-600 text-white font-medium py-2 px-4 rounded-lg focus:outline-none focus:ring-2 focus:ring-secondary-200 focus:ring-offset-2">
172
+ Submit Feedback
173
+ </button>
174
+ </div>
175
+ </div>
176
+ </div>
177
+
178
+ <script>
179
+ document.addEventListener('DOMContentLoaded', function() {
180
+ const translateBtn = document.getElementById('translate-btn');
181
+ const originalMessage = document.getElementById('original-message');
182
+ const transformationType = document.getElementById('transformation-type');
183
+ const outputSection = document.getElementById('output-section');
184
+ const translatedOutput = document.getElementById('translated-output');
185
+ const feedbackBtn = document.getElementById('feedback-btn');
186
+ const feedbackText = document.getElementById('feedback-text');
187
+
188
+ // Mock translation function
189
+ function mockTranslate(message, type) {
190
+ // Simulate API call delay
191
+ return new Promise(resolve => {
192
+ setTimeout(() => {
193
+ const transformations = {
194
+ 'clarify': `Clarified version: ${message} (I mean this sincerely and want to communicate my thoughts clearly)`,
195
+ 'decode': `Decoded meaning: This likely means "${message}" but might be confusing due to neurodivergent communication style`,
196
+ 'professional': `Professional version: Dear colleague, ${message}. Best regards.`,
197
+ 'soften': `Gentler phrasing: I was wondering if perhaps ${message.toLowerCase()}? No pressure though!`,
198
+ 'meltdown': `Emergency support message: I'm struggling right now. I need help with: ${message}. Can we talk about this when I'm calmer?`
199
+ };
200
+ resolve(transformations[type] || message);
201
+ }, 800);
202
+ });
203
+ }
204
+
205
+ // Translate button click handler
206
+ translateBtn.addEventListener('click', async function() {
207
+ const message = originalMessage.value.trim();
208
+ const type = transformationType.value;
209
+
210
+ if (!message) {
211
+ alert('Please enter a message to translate');
212
+ return;
213
+ }
214
+
215
+ // Show loading state
216
+ translateBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Translating...';
217
+ translateBtn.disabled = true;
218
+
219
+ // Mock API call
220
+ try {
221
+ const result = await mockTranslate(message, type);
222
+ translatedOutput.textContent = result;
223
+ outputSection.classList.remove('hidden');
224
+
225
+ // Scroll to output
226
+ outputSection.scrollIntoView({ behavior: 'smooth' });
227
+ } catch (error) {
228
+ console.error('Translation error:', error);
229
+ alert('Translation failed. Please try again.');
230
+ } finally {
231
+ // Reset button
232
+ translateBtn.innerHTML = '<i class="fas fa-language mr-2"></i> Translate';
233
+ translateBtn.disabled = false;
234
+ }
235
+ });
236
+
237
+ // Feedback button click handler
238
+ feedbackBtn.addEventListener('click', function() {
239
+ const feedback = feedbackText.value.trim();
240
+
241
+ if (!feedback) {
242
+ alert('Please provide some feedback');
243
+ return;
244
+ }
245
+
246
+ // Show loading state
247
+ feedbackBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Submitting...';
248
+ feedbackBtn.disabled = true;
249
+
250
+ // Mock API call
251
+ setTimeout(() => {
252
+ alert('Thank you for your feedback! We appreciate your input.');
253
+ feedbackText.value = '';
254
+ feedbackBtn.innerHTML = 'Submit Feedback';
255
+ feedbackBtn.disabled = false;
256
+ }, 800);
257
+ });
258
+
259
+ // Accessibility: Make textareas auto-expand
260
+ function autoExpand(textarea) {
261
+ textarea.style.height = 'auto';
262
+ textarea.style.height = (textarea.scrollHeight) + 'px';
263
+ }
264
+
265
+ originalMessage.addEventListener('input', function() {
266
+ autoExpand(this);
267
+ });
268
+
269
+ feedbackText.addEventListener('input', function() {
270
+ autoExpand(this);
271
+ });
272
+ });
273
+ </script>
274
+ <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=nomadicsynth/neurodivergent-translator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
275
+ </html>
prompts.txt ADDED
File without changes