cfalk43 commited on
Commit
272add3
·
verified ·
1 Parent(s): 196f698

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +98 -19
index.html CHANGED
@@ -2,28 +2,107 @@
2
  <html lang="en">
3
 
4
  <head>
5
- <meta charset="UTF-8" />
6
- <link rel="stylesheet" href="style.css" />
7
-
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
- <title>Transformers.js - Object Detection</title>
10
  </head>
11
 
12
  <body>
13
- <h1>Object Detection w/ 🤗 Transformers.js</h1>
14
- <label id="container" for="upload">
15
- <svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
16
- <path fill="#000"
17
- d="M3.5 24.3a3 3 0 0 1-1.9-.8c-.5-.5-.8-1.2-.8-1.9V2.9c0-.7.3-1.3.8-1.9.6-.5 1.2-.7 2-.7h18.6c.7 0 1.3.2 1.9.7.5.6.7 1.2.7 2v18.6c0 .7-.2 1.4-.7 1.9a3 3 0 0 1-2 .8H3.6Zm0-2.7h18.7V2.9H3.5v18.7Zm2.7-2.7h13.3c.3 0 .5 0 .6-.3v-.7l-3.7-5a.6.6 0 0 0-.6-.2c-.2 0-.4 0-.5.3l-3.5 4.6-2.4-3.3a.6.6 0 0 0-.6-.3c-.2 0-.4.1-.5.3l-2.7 3.6c-.1.2-.2.4 0 .7.1.2.3.3.6.3Z">
18
- </path>
19
- </svg>
20
- Click to upload image
21
- <label id="example">(or try example)</label>
22
- </label>
23
- <label id="status">Loading model...</label>
24
- <input id="upload" type="file" accept="image/*" />
25
-
26
- <script src="index.js" type="module"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>