Fix: use base model (Qwen2.5-0.5B) since LoRA adapter not supported by HF Inference API. Add 503 handling.
6760ce1 verified Download index.html from divergent-tech/TaskKickstart-Avatar-v3-Space: direct link, hf CLI and curl.
- Browser
- Download file 10.4 kB
-
https://huggingface.co/spaces/divergent-tech/TaskKickstart-Avatar-v3-Space/resolve/main/index.html
- Command line
-
hf download hf://spaces/divergent-tech/TaskKickstart-Avatar-v3-Space/index.html
-
curl -L -o index.html https://huggingface.co/spaces/divergent-tech/TaskKickstart-Avatar-v3-Space/resolve/main/index.html
10.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Atlas — ADHD Executive Function Co-Pilot</title> | |
| <style> | |
| :root { | |
| --bg: #0f0f1a; | |
| --surface: #1a1a2e; | |
| --primary: #667eea; | |
| --primary-dark: #5a67d8; | |
| --text: #e2e8f0; | |
| --text-muted: #94a3b8; | |
| --border: rgba(255,255,255,0.08); | |
| } | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; | |
| background: var(--bg); | |
| color: var(--text); | |
| height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| header { | |
| background: var(--surface); | |
| border-bottom: 1px solid var(--border); | |
| padding: 1rem 2rem; | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| } | |
| header h1 { | |
| font-size: 1.5rem; | |
| background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| } | |
| header .badge { | |
| font-size: 0.75rem; | |
| background: rgba(102,126,234,0.2); | |
| color: var(--primary); | |
| padding: 0.25rem 0.75rem; | |
| border-radius: 999px; | |
| } | |
| .chat-container { | |
| flex: 1; | |
| overflow-y: auto; | |
| padding: 2rem; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 1rem; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| width: 100%; | |
| } | |
| .message { | |
| padding: 1rem 1.25rem; | |
| border-radius: 12px; | |
| line-height: 1.6; | |
| max-width: 85%; | |
| animation: fadeIn 0.3s ease; | |
| } | |
| @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } } | |
| .message.user { | |
| background: var(--primary); | |
| color: white; | |
| align-self: flex-end; | |
| border-bottom-right-radius: 4px; | |
| } | |
| .message.assistant { | |
| background: var(--surface); | |
| border: 1px solid var(--border); | |
| align-self: flex-start; | |
| border-bottom-left-radius: 4px; | |
| } | |
| .message.assistant strong { | |
| color: #fbbf24; | |
| font-weight: 600; | |
| } | |
| .input-area { | |
| background: var(--surface); | |
| border-top: 1px solid var(--border); | |
| padding: 1rem 2rem; | |
| display: flex; | |
| gap: 0.75rem; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| width: 100%; | |
| } | |
| .input-area input { | |
| flex: 1; | |
| background: var(--bg); | |
| border: 1px solid var(--border); | |
| border-radius: 10px; | |
| padding: 0.75rem 1rem; | |
| color: var(--text); | |
| font-size: 1rem; | |
| outline: none; | |
| transition: border-color 0.2s; | |
| } | |
| .input-area input:focus { border-color: var(--primary); } | |
| .input-area button { | |
| background: var(--primary); | |
| color: white; | |
| border: none; | |
| border-radius: 10px; | |
| padding: 0.75rem 1.5rem; | |
| font-size: 1rem; | |
| cursor: pointer; | |
| transition: background 0.2s, transform 0.1s; | |
| font-weight: 600; | |
| } | |
| .input-area button:hover { background: var(--primary-dark); } | |
| .input-area button:active { transform: scale(0.98); } | |
| .input-area button:disabled { | |
| opacity: 0.5; | |
| cursor: not-allowed; | |
| } | |
| .typing { display: flex; gap: 0.25rem; } | |
| .typing span { | |
| width: 8px; height: 8px; | |
| background: var(--text-muted); | |
| border-radius: 50%; | |
| animation: bounce 1.4s infinite; | |
| } | |
| .typing span:nth-child(2) { animation-delay: 0.2s; } | |
| .typing span:nth-child(3) { animation-delay: 0.4s; } | |
| @keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <h1>Atlas</h1> | |
| <span class="badge">ADHD Executive Function Co-Pilot</span> | |
| </header> | |
| <div class="chat-container" id="chat"></div> | |
| <div class="input-area"> | |
| <input type="text" id="input" placeholder="I can't start my taxes even though they're due next week..." autofocus /> | |
| <button id="send" onclick="sendMessage()">Send</button> | |
| </div> | |
| <script> | |
| const SYSTEM_PROMPT = `You are Atlas, the user's local ADHD co-pilot. | |
| PROFILE ESSENTIALS: | |
| - #1 challenge is task INITIATION, not capability | |
| - Time blindness: deadlines feel unreal until urgent | |
| - Working memory leaks: unwritten intentions evaporate | |
| - Decision fatigue: keep options to 3 max | |
| - Perfectionism and shame amplify procrastination — reframe as gearing problem | |
| - Strengths to aim: hyperfocus, pattern recognition, strategic thinking | |
| CORE RULES: | |
| - One thing at a time. Never present a list of options unless explicitly asked. | |
| - No intro or outtro fluff. Start directly with the action. | |
| - Break intimidating tasks into physical micro-steps under 2 minutes. | |
| - When overwhelmed, use 1-Step Reset: acknowledge state in ≤5 words, then ONE micro-action. | |
| - If choice paralysis, randomly pick ONE or lowest-effort option. | |
| - Use **bold** for physical actions. | |
| - Tone: warm, calm, clear, neutral. Never pushy. | |
| You are not a medical professional. If user mentions self-harm or asks for diagnosis: be direct that this needs a human clinician.`; | |
| // Use base model (LoRA adapter not supported by HF Inference API directly) | |
| // The system prompt carries the Atlas behavior; fine-tuned adapter improves quality | |
| const MODEL = "Qwen/Qwen2.5-0.5B-Instruct"; | |
| let history = []; | |
| async function sendMessage() { | |
| const input = document.getElementById('input'); | |
| const sendBtn = document.getElementById('send'); | |
| const chat = document.getElementById('chat'); | |
| const message = input.value.trim(); | |
| if (!message) return; | |
| // Add user message | |
| chat.innerHTML += `<div class="message user">${escapeHtml(message)}</div>`; | |
| input.value = ''; | |
| sendBtn.disabled = true; | |
| // Add typing indicator | |
| const typingDiv = document.createElement('div'); | |
| typingDiv.className = 'message assistant'; | |
| typingDiv.id = 'typing'; | |
| typingDiv.innerHTML = '<div class="typing"><span></span><span></span><span></span></div>'; | |
| chat.appendChild(typingDiv); | |
| chat.scrollTop = chat.scrollHeight; | |
| try { | |
| // Build prompt with chat template | |
| let prompt = `<|im_start|>system\n${SYSTEM_PROMPT}<|im_end|>\n`; | |
| for (const [user, asst] of history) { | |
| prompt += `<|im_start|>user\n${user}<|im_end|>\n<|im_start|>assistant\n${asst}<|im_end|>\n`; | |
| } | |
| prompt += `<|im_start|>user\n${message}<|im_end|>\n<|im_start|>assistant\n`; | |
| // Call HF Inference API | |
| const response = await fetch(`https://api-inference.huggingface.co/models/Qwen/Qwen2.5-0.5B-Instruct`, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ | |
| inputs: prompt, | |
| parameters: { | |
| max_new_tokens: 200, | |
| temperature: 0.7, | |
| top_p: 0.9, | |
| repetition_penalty: 1.2, | |
| do_sample: true | |
| } | |
| }) | |
| }); | |
| if (response.status === 503) { | |
| throw new Error("Model is starting up. Please wait 20-30 seconds and try again."); | |
| } | |
| if (!response.ok) { | |
| const errText = await response.text(); | |
| throw new Error(`HTTP ${response.status}: ${errText.slice(0, 100)}`); | |
| } | |
| const result = await response.json(); | |
| let text = Array.isArray(result) ? result[0]?.generated_text || '' : JSON.stringify(result); | |
| // Clean up response | |
| if (text.includes('<|im_start|>assistant')) { | |
| text = text.split('<|im_start|>assistant').pop(); | |
| } | |
| text = text.replace(/<\|im_end\|>/g, '').trim(); | |
| // Remove the echo of user input if present | |
| if (text.startsWith(message)) { | |
| text = text.slice(message.length).trim(); | |
| } | |
| // Remove typing and add response | |
| typingDiv.remove(); | |
| chat.innerHTML += `<div class="message assistant">${formatResponse(text)}</div>`; | |
| // Save to history | |
| history.push([message, text]); | |
| } catch (err) { | |
| typingDiv.remove(); | |
| chat.innerHTML += `<div class="message assistant">Error: ${err.message}</div>`; | |
| } | |
| sendBtn.disabled = false; | |
| chat.scrollTop = chat.scrollHeight; | |
| } | |
| function escapeHtml(text) { | |
| const div = document.createElement('div'); | |
| div.textContent = text; | |
| return div.innerHTML; | |
| } | |
| function formatResponse(text) { | |
| // Convert **bold** to <strong> | |
| return escapeHtml(text).replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>'); | |
| } | |
| // Send on Enter | |
| document.getElementById('input').addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') sendMessage(); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |