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

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +102 -21
index.html CHANGED
@@ -1,29 +1,110 @@
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>Gemma AI Chatbot</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
10
  </head>
 
11
  <body>
12
+ <div class="app-container">
13
+ <!-- Header -->
14
+ <header class="header">
15
+ <div class="header-content">
16
+ <div class="logo">
17
+ <i class="fas fa-robot"></i>
18
+ <h1>Gemma AI Chatbot</h1>
19
+ </div>
20
+ <div class="device-toggle">
21
+ <span class="device-label">Execution:</span>
22
+ <button id="deviceToggle" class="device-btn">
23
+ <span class="device-option active" data-device="cpu">CPU</span>
24
+ <span class="device-option" data-device="webgpu">GPU</span>
25
+ </button>
26
+ <div class="status-indicator">
27
+ <i class="fas fa-circle"></i>
28
+ <span id="statusText">Loading...</span>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <div class="credit">
33
+ Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" rel="noopener noreferrer">anycoder</a>
34
+ </div>
35
+ </header>
36
 
37
+ <!-- Main Chat Area -->
38
+ <main class="main-content">
39
+ <div class="chat-container">
40
+ <div class="messages-container" id="messagesContainer">
41
+ <div class="welcome-message">
42
+ <div class="welcome-icon">
43
+ <i class="fas fa-comments"></i>
44
+ </div>
45
+ <h2>Welcome to Gemma AI Chatbot</h2>
46
+ <p>Start a conversation with the AI assistant. I'm here to help with any questions you have!</p>
47
+ </div>
48
+ </div>
49
+
50
+ <!-- Input Area -->
51
+ <div class="input-container">
52
+ <div class="input-wrapper">
53
+ <textarea
54
+ id="messageInput"
55
+ placeholder="Type your message here..."
56
+ rows="1"
57
+ disabled
58
+ ></textarea>
59
+ <button id="sendButton" class="send-button" disabled>
60
+ <i class="fas fa-paper-plane"></i>
61
+ </button>
62
+ </div>
63
+ <div class="input-footer">
64
+ <span class="model-info">
65
+ <i class="fas fa-microchip"></i>
66
+ Model: gemma-3-270m-it-ONNX
67
+ </span>
68
+ <span class="char-count">
69
+ <span id="charCount">0</span>/1000
70
+ </span>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </main>
75
 
76
+ <!-- Loading Overlay -->
77
+ <div class="loading-overlay" id="loadingOverlay">
78
+ <div class="loading-content">
79
+ <div class="loading-spinner">
80
+ <div class="spinner"></div>
81
+ </div>
82
+ <h3>Initializing AI Model</h3>
83
+ <p>Please wait while we load the Gemma AI model...</p>
84
+ <div class="progress-bar">
85
+ <div class="progress-fill" id="progressFill"></div>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <!-- Error Modal -->
91
+ <div class="error-modal" id="errorModal">
92
+ <div class="error-content">
93
+ <div class="error-icon">
94
+ <i class="fas fa-exclamation-triangle"></i>
95
+ </div>
96
+ <h3>Error</h3>
97
+ <p id="errorMessage">An error occurred while initializing the AI model.</p>
98
+ <button class="retry-button" id="retryButton">Retry</button>
99
+ </div>
100
+ </div>
101
+ </div>
102
+
103
+ <!-- Transformers.js Import -->
104
+ <script type="module">
105
+ import { pipeline, TextStreamer } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.3';
106
+ window.transformers = { pipeline, TextStreamer };
107
+ </script>
108
+ <script src="index.js"></script>
109
+ </body>
110
  </html>