sheikhcoders commited on
Commit
653ab2f
·
verified ·
1 Parent(s): 593456e

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +227 -0
index.html ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Model Runner - Lightweight</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ max-width: 1200px;
11
+ margin: 0 auto;
12
+ padding: 20px;
13
+ background: #f5f5f5;
14
+ }
15
+ .container {
16
+ background: white;
17
+ padding: 30px;
18
+ border-radius: 10px;
19
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
20
+ }
21
+ .endpoint {
22
+ margin: 20px 0;
23
+ padding: 20px;
24
+ border: 1px solid #ddd;
25
+ border-radius: 5px;
26
+ background: #fafafa;
27
+ }
28
+ .endpoint h3 {
29
+ margin-top: 0;
30
+ color: #333;
31
+ }
32
+ input, textarea, button {
33
+ width: 100%;
34
+ padding: 10px;
35
+ margin: 5px 0;
36
+ border: 1px solid #ccc;
37
+ border-radius: 5px;
38
+ box-sizing: border-box;
39
+ }
40
+ button {
41
+ background: #007bff;
42
+ color: white;
43
+ border: none;
44
+ cursor: pointer;
45
+ }
46
+ button:hover {
47
+ background: #0056b3;
48
+ }
49
+ .result {
50
+ background: #e8f5e8;
51
+ padding: 10px;
52
+ margin-top: 10px;
53
+ border-radius: 5px;
54
+ border-left: 4px solid #28a745;
55
+ }
56
+ .error {
57
+ background: #ffe8e8;
58
+ padding: 10px;
59
+ margin-top: 10px;
60
+ border-radius: 5px;
61
+ border-left: 4px solid #dc3545;
62
+ }
63
+ .header {
64
+ text-align: center;
65
+ color: #333;
66
+ border-bottom: 2px solid #007bff;
67
+ padding-bottom: 20px;
68
+ margin-bottom: 30px;
69
+ }
70
+ </style>
71
+ </head>
72
+ <body>
73
+ <div class="container">
74
+ <div class="header">
75
+ <h1>🚀 AI Model Runner - Lightweight</h1>
76
+ <p>Fast, lightweight AI endpoints for testing and integration</p>
77
+ </div>
78
+
79
+ <div class="endpoint">
80
+ <h3>💬 Chat Endpoint</h3>
81
+ <input type="text" id="chatMessage" placeholder="Enter your message...">
82
+ <button onclick="testChat()">Send Message</button>
83
+ <div id="chatResult"></div>
84
+ </div>
85
+
86
+ <div class="endpoint">
87
+ <h3>💻 Code Analysis</h3>
88
+ <textarea id="codeInput" rows="5" placeholder="Enter your code here..."></textarea>
89
+ <input type="text" id="codeTask" placeholder="Task (explain, optimize, debug)">
90
+ <button onclick="testCode()">Analyze Code</button>
91
+ <div id="codeResult"></div>
92
+ </div>
93
+
94
+ <div class="endpoint">
95
+ <h3>🧠 Reasoning</h3>
96
+ <textarea id="reasoningInput" rows="4" placeholder="Enter your problem or question..."></textarea>
97
+ <input type="text" id="reasoningContext" placeholder="Additional context (optional)">
98
+ <button onclick="testReasoning()">Get Reasoning</button>
99
+ <div id="reasoningResult"></div>
100
+ </div>
101
+
102
+ <div class="endpoint">
103
+ <h3>😊 Sentiment Analysis</h3>
104
+ <textarea id="sentimentInput" rows="3" placeholder="Enter text to analyze sentiment..."></textarea>
105
+ <button onclick="testSentiment()">Analyze Sentiment</button>
106
+ <div id="sentimentResult"></div>
107
+ </div>
108
+
109
+ <div class="endpoint">
110
+ <h3>🤖 Agentic Model (Tool Use + Interleaved Thinking)</h3>
111
+ <textarea id="agenticTask" rows="3" placeholder="Enter your task (e.g., 'Search for latest AI trends', 'Analyze this code', 'What's the weather?', 'Calculate 15 * 23 + 7')"></textarea>
112
+ <textarea id="agenticContext" rows="2" placeholder="Additional context or parameters (optional)"></textarea>
113
+ <button onclick="testAgentic()">Execute Task with Tool Use</button>
114
+ <div id="agenticResult"></div>
115
+ </div>
116
+
117
+ <div class="endpoint">
118
+ <h3>🔗 API Information</h3>
119
+ <button onclick="loadAPIInfo()">Load API Info</button>
120
+ <button onclick="checkHealth()">Health Check</button>
121
+ <button onclick="loadModels()">List Models</button>
122
+ <div id="apiResult"></div>
123
+ </div>
124
+ </div>
125
+
126
+ <script>
127
+ const API_BASE = '';
128
+
129
+ async function makeRequest(endpoint, data) {
130
+ try {
131
+ const response = await fetch(endpoint, {
132
+ method: 'POST',
133
+ headers: { 'Content-Type': 'application/json' },
134
+ body: JSON.stringify(data)
135
+ });
136
+ return await response.json();
137
+ } catch (error) {
138
+ return { error: error.message };
139
+ }
140
+ }
141
+
142
+ async function makeGetRequest(endpoint) {
143
+ try {
144
+ const response = await fetch(endpoint);
145
+ return await response.json();
146
+ } catch (error) {
147
+ return { error: error.message };
148
+ }
149
+ }
150
+
151
+ function displayResult(elementId, result) {
152
+ const element = document.getElementById(elementId);
153
+ const isError = result.error;
154
+ element.className = isError ? 'error' : 'result';
155
+ element.innerHTML = `<pre>${JSON.stringify(result, null, 2)}</pre>`;
156
+ }
157
+
158
+ async function testChat() {
159
+ const message = document.getElementById('chatMessage').value;
160
+ if (!message) {
161
+ displayResult('chatResult', { error: 'Please enter a message' });
162
+ return;
163
+ }
164
+ const result = await makeRequest('/chat', { message });
165
+ displayResult('chatResult', result);
166
+ }
167
+
168
+ async function testCode() {
169
+ const code = document.getElementById('codeInput').value;
170
+ const task = document.getElementById('codeTask').value || 'explain';
171
+ if (!code) {
172
+ displayResult('codeResult', { error: 'Please enter code' });
173
+ return;
174
+ }
175
+ const result = await makeRequest('/code', { code, task });
176
+ displayResult('codeResult', result);
177
+ }
178
+
179
+ async function testReasoning() {
180
+ const problem = document.getElementById('reasoningInput').value;
181
+ const context = document.getElementById('reasoningContext').value;
182
+ if (!problem) {
183
+ displayResult('reasoningResult', { error: 'Please enter a problem' });
184
+ return;
185
+ }
186
+ const result = await makeRequest('/reasoning', { problem, context });
187
+ displayResult('reasoningResult', result);
188
+ }
189
+
190
+ async function testSentiment() {
191
+ const text = document.getElementById('sentimentInput').value;
192
+ if (!text) {
193
+ displayResult('sentimentResult', { error: 'Please enter text' });
194
+ return;
195
+ }
196
+ const result = await makeRequest('/analyze-sentiment', { text });
197
+ displayResult('sentimentResult', result);
198
+ }
199
+
200
+ async function testAgentic() {
201
+ const task = document.getElementById('agenticTask').value;
202
+ const context = document.getElementById('agenticContext').value;
203
+ if (!task) {
204
+ displayResult('agenticResult', { error: 'Please enter a task' });
205
+ return;
206
+ }
207
+ const result = await makeRequest('/agentic', { task, context });
208
+ displayResult('agenticResult', result);
209
+ }
210
+
211
+ async function loadAPIInfo() {
212
+ const result = await makeGetRequest('/');
213
+ displayResult('apiResult', result);
214
+ }
215
+
216
+ async function checkHealth() {
217
+ const result = await makeGetRequest('/health');
218
+ displayResult('apiResult', result);
219
+ }
220
+
221
+ async function loadModels() {
222
+ const result = await makeGetRequest('/models');
223
+ displayResult('apiResult', result);
224
+ }
225
+ </script>
226
+ </body>
227
+ </html>