Spaces:
Running
Running
Upload index.html with huggingface_hub
Browse files- index.html +71 -21
index.html
CHANGED
|
@@ -1,29 +1,79 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
-
|
| 4 |
<head>
|
| 5 |
-
<meta charset="UTF-8"
|
| 6 |
-
<
|
| 7 |
-
|
| 8 |
-
<
|
| 9 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</head>
|
| 11 |
-
|
| 12 |
<body>
|
| 13 |
-
<
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
</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 Chatbot - Powered by Transformers.js</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script type="module">
|
| 9 |
+
import { pipeline, TextStreamer } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.3';
|
| 10 |
+
|
| 11 |
+
// Make transformers available globally
|
| 12 |
+
window.transformers = { pipeline, TextStreamer };
|
| 13 |
+
</script>
|
| 14 |
</head>
|
|
|
|
| 15 |
<body>
|
| 16 |
+
<div class="app-container">
|
| 17 |
+
<header class="app-header">
|
| 18 |
+
<div class="header-content">
|
| 19 |
+
<h1>🤖 AI Chatbot</h1>
|
| 20 |
+
<div class="header-controls">
|
| 21 |
+
<div class="device-toggle">
|
| 22 |
+
<label for="deviceSelect">Device:</label>
|
| 23 |
+
<select id="deviceSelect">
|
| 24 |
+
<option value="cpu">CPU (Default)</option>
|
| 25 |
+
<option value="webgpu">GPU (WebGPU)</option>
|
| 26 |
+
</select>
|
| 27 |
+
</div>
|
| 28 |
+
</div>
|
| 29 |
+
</div>
|
| 30 |
+
<div class="anycoder-link">
|
| 31 |
+
Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" rel="noopener">anycoder</a>
|
| 32 |
+
</div>
|
| 33 |
+
</header>
|
| 34 |
|
| 35 |
+
<main class="chat-container">
|
| 36 |
+
<div class="chat-messages" id="chatMessages">
|
| 37 |
+
<div class="welcome-message">
|
| 38 |
+
<h2>Welcome to AI Chatbot!</h2>
|
| 39 |
+
<p>I'm powered by the Gemma 3 270M model and can help you with various questions. Start chatting below!</p>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
|
| 43 |
+
<div class="chat-input-container">
|
| 44 |
+
<div class="input-wrapper">
|
| 45 |
+
<textarea
|
| 46 |
+
id="messageInput"
|
| 47 |
+
placeholder="Type your message here... (Press Enter to send, Shift+Enter for new line)"
|
| 48 |
+
rows="1"
|
| 49 |
+
></textarea>
|
| 50 |
+
<button id="sendButton" disabled>
|
| 51 |
+
<span class="send-icon">➤</span>
|
| 52 |
+
</button>
|
| 53 |
+
</div>
|
| 54 |
+
<div class="input-status" id="inputStatus"></div>
|
| 55 |
+
</div>
|
| 56 |
+
</main>
|
| 57 |
+
|
| 58 |
+
<div class="loading-overlay" id="loadingOverlay">
|
| 59 |
+
<div class="loading-content">
|
| 60 |
+
<div class="loading-spinner"></div>
|
| 61 |
+
<div class="loading-text">
|
| 62 |
+
<h3 id="loadingTitle">Initializing AI Model...</h3>
|
| 63 |
+
<p id="loadingDescription">This may take a moment on first load</p>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
|
| 68 |
+
<div class="error-message" id="errorMessage" style="display: none;">
|
| 69 |
+
<div class="error-content">
|
| 70 |
+
<h3>⚠️ Error</h3>
|
| 71 |
+
<p id="errorText"></p>
|
| 72 |
+
<button onclick="hideError()">Try Again</button>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<script src="index.js"></script>
|
| 78 |
+
</body>
|
| 79 |
</html>
|