Spaces:
Running
Running
Upload index.html with huggingface_hub
Browse files- index.html +98 -19
index.html
CHANGED
|
@@ -2,28 +2,107 @@
|
|
| 2 |
<html lang="en">
|
| 3 |
|
| 4 |
<head>
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
<title>Transformers.js - Object Detection</title>
|
| 10 |
</head>
|
| 11 |
|
| 12 |
<body>
|
| 13 |
-
|
| 14 |
-
<
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
</body>
|
| 28 |
|
| 29 |
</html>
|
|
|
|
| 2 |
<html lang="en">
|
| 3 |
|
| 4 |
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Browser LLM/SLM Chat - Vision & Text</title>
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
|
|
|
| 9 |
</head>
|
| 10 |
|
| 11 |
<body>
|
| 12 |
+
<div class="container">
|
| 13 |
+
<header>
|
| 14 |
+
<h1>🤖 Browser AI Chat</h1>
|
| 15 |
+
<p class="subtitle">Run LLMs & Vision Models directly in your browser</p>
|
| 16 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="attribution">Built with
|
| 17 |
+
anycoder</a>
|
| 18 |
+
</header>
|
| 19 |
+
|
| 20 |
+
<div class="model-selector">
|
| 21 |
+
<label for="model-select">Select Model:</label>
|
| 22 |
+
<select id="model-select">
|
| 23 |
+
<optgroup label="Vision-Language Models">
|
| 24 |
+
<option value="HuggingFaceTB/SmolVLM-256M-Instruct">SmolVLM-256M-Instruct (Vision)</option>
|
| 25 |
+
<option value="HuggingFaceTB/SmolVLM-500M-Instruct">SmolVLM-500M-Instruct (Vision)</option>
|
| 26 |
+
</optgroup>
|
| 27 |
+
<optgroup label="Text-Only Models">
|
| 28 |
+
<option value="HuggingFaceTB/SmolLM2-135M-Instruct">SmolLM2-135M-Instruct</option>
|
| 29 |
+
<option value="HuggingFaceTB/SmolLM2-360M-Instruct">SmolLM2-360M-Instruct</option>
|
| 30 |
+
<option value="Qwen/Qwen2.5-0.5B-Instruct">Qwen2.5-0.5B-Instruct</option>
|
| 31 |
+
</optgroup>
|
| 32 |
+
</select>
|
| 33 |
+
<button id="load-model-btn" class="btn btn-primary">Load Model</button>
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<div id="loading-container" class="loading-container hidden">
|
| 37 |
+
<div class="loading-spinner"></div>
|
| 38 |
+
<p id="loading-status">Initializing...</p>
|
| 39 |
+
<div class="progress-bar-container">
|
| 40 |
+
<div id="progress-bar" class="progress-bar"></div>
|
| 41 |
+
</div>
|
| 42 |
+
<p id="progress-text">0%</p>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<div id="chat-container" class="chat-container hidden">
|
| 46 |
+
<div id="chat-messages" class="chat-messages">
|
| 47 |
+
<div class="welcome-message">
|
| 48 |
+
<p>👋 Welcome! Load a model to start chatting.</p>
|
| 49 |
+
<p class="hint">Vision models can analyze images. Text models are for conversation only.</p>
|
| 50 |
+
</div>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<div id="image-preview-container" class="image-preview-container hidden">
|
| 54 |
+
<img id="image-preview" alt="Preview">
|
| 55 |
+
<button id="remove-image-btn" class="remove-image-btn">×</button>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<div class="input-container">
|
| 59 |
+
<div class="input-row">
|
| 60 |
+
<input type="file" id="image-input" accept="image/*" class="hidden">
|
| 61 |
+
<button id="attach-image-btn" class="btn btn-icon" title="Attach Image">
|
| 62 |
+
📷
|
| 63 |
+
</button>
|
| 64 |
+
<input type="text" id="image-url-input" placeholder="Or paste image URL..." class="image-url-input">
|
| 65 |
+
<button id="load-url-btn" class="btn btn-secondary">Load URL</button>
|
| 66 |
+
</div>
|
| 67 |
+
<div class="input-row">
|
| 68 |
+
<textarea id="user-input" placeholder="Type your message..." rows="2"></textarea>
|
| 69 |
+
<button id="send-btn" class="btn btn-primary" disabled>Send</button>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<div class="settings-panel">
|
| 74 |
+
<details>
|
| 75 |
+
<summary>⚙️ Generation Settings</summary>
|
| 76 |
+
<div class="settings-grid">
|
| 77 |
+
<div class="setting-item">
|
| 78 |
+
<label for="max-tokens">Max Tokens: <span id="max-tokens-value">256</span></label>
|
| 79 |
+
<input type="range" id="max-tokens" min="32" max="1024" value="256">
|
| 80 |
+
</div>
|
| 81 |
+
<div class="setting-item">
|
| 82 |
+
<label for="temperature">Temperature: <span id="temperature-value">0.7</span></label>
|
| 83 |
+
<input type="range" id="temperature" min="0" max="2" step="0.1" value="0.7">
|
| 84 |
+
</div>
|
| 85 |
+
<div class="setting-item">
|
| 86 |
+
<label for="top-p">Top P: <span id="top-p-value">0.9</span></label>
|
| 87 |
+
<input type="range" id="top-p" min="0" max="1" step="0.05" value="0.9">
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
</details>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
|
| 94 |
+
<div id="error-container" class="error-container hidden">
|
| 95 |
+
<p id="error-message"></p>
|
| 96 |
+
<button id="dismiss-error-btn" class="btn btn-secondary">Dismiss</button>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<footer>
|
| 100 |
+
<p>Models run entirely in your browser using <a href="https://huggingface.co/docs/transformers.js"
|
| 101 |
+
target="_blank">Transformers.js</a> & WebGPU</p>
|
| 102 |
+
</footer>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<script type="module" src="index.js"></script>
|
| 106 |
</body>
|
| 107 |
|
| 108 |
</html>
|