akhaliq HF Staff commited on
Commit
66f381c
·
verified ·
1 Parent(s): 196f698

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. 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
- <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>
 
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>