Spaces:
Sleeping
Sleeping
Upload index.html with huggingface_hub
Browse files- index.html +55 -202
index.html
CHANGED
|
@@ -1,227 +1,80 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html
|
| 3 |
<head>
|
| 4 |
-
<
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>AI Model Runner - Lightweight</title>
|
| 7 |
<style>
|
| 8 |
-
body {
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 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 |
-
<
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
</
|
| 78 |
-
|
| 79 |
-
<
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 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 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
<button onclick="loadModels()">List Models</button>
|
| 122 |
-
<div id="apiResult"></div>
|
| 123 |
-
</div>
|
| 124 |
</div>
|
| 125 |
|
| 126 |
<script>
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
try {
|
| 131 |
-
const response = await fetch(
|
| 132 |
method: 'POST',
|
| 133 |
headers: { 'Content-Type': 'application/json' },
|
| 134 |
-
body: JSON.stringify(
|
| 135 |
});
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
} catch (error) {
|
| 138 |
-
|
|
|
|
| 139 |
}
|
| 140 |
}
|
| 141 |
|
| 142 |
-
async function
|
|
|
|
|
|
|
| 143 |
try {
|
| 144 |
-
const response = await fetch(
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
} catch (error) {
|
| 147 |
-
|
|
|
|
| 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>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
<head>
|
| 4 |
+
<title>AI Model Runner - Test</title>
|
|
|
|
|
|
|
| 5 |
<style>
|
| 6 |
+
body { font-family: Arial, sans-serif; max-width: 800px; margin: 50px auto; padding: 20px; }
|
| 7 |
+
.test { background: #f0f0f0; padding: 20px; margin: 10px 0; border-radius: 5px; }
|
| 8 |
+
button { background: #007bff; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; }
|
| 9 |
+
.result { background: #e8f5e8; padding: 10px; margin-top: 10px; border-radius: 5px; }
|
| 10 |
+
.error { background: #ffe8e8; padding: 10px; margin-top: 10px; border-radius: 5px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</style>
|
| 12 |
</head>
|
| 13 |
<body>
|
| 14 |
+
<h1>🤖 AI Model Runner - Agentic Test</h1>
|
| 15 |
+
<p>Testing the Agentic Model with Interleaved Thinking and Tool Use capabilities</p>
|
| 16 |
+
|
| 17 |
+
<div class="test">
|
| 18 |
+
<h3>Agentic Model Test</h3>
|
| 19 |
+
<textarea id="task" rows="3" placeholder="Enter your task (e.g., 'Search for AI trends', 'Calculate 15 * 23 + 7')"></textarea>
|
| 20 |
+
<textarea id="context" rows="2" placeholder="Additional context (optional)"></textarea>
|
| 21 |
+
<button onclick="testAgentic()">Test Agentic Model</button>
|
| 22 |
+
<div id="result"></div>
|
| 23 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
<div class="test">
|
| 26 |
+
<h3>Direct API Test</h3>
|
| 27 |
+
<button onclick="testDirect()">Test Direct API Call</button>
|
| 28 |
+
<div id="directResult"></div>
|
|
|
|
|
|
|
|
|
|
| 29 |
</div>
|
| 30 |
|
| 31 |
<script>
|
| 32 |
+
async function testAgentic() {
|
| 33 |
+
const task = document.getElementById('task').value;
|
| 34 |
+
const context = document.getElementById('context').value;
|
| 35 |
+
const resultDiv = document.getElementById('result');
|
| 36 |
+
|
| 37 |
+
if (!task) {
|
| 38 |
+
resultDiv.className = 'error';
|
| 39 |
+
resultDiv.innerHTML = 'Please enter a task';
|
| 40 |
+
return;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
try {
|
| 44 |
+
const response = await fetch('/agentic', {
|
| 45 |
method: 'POST',
|
| 46 |
headers: { 'Content-Type': 'application/json' },
|
| 47 |
+
body: JSON.stringify({ task, context })
|
| 48 |
});
|
| 49 |
+
|
| 50 |
+
const data = await response.json();
|
| 51 |
+
resultDiv.className = response.ok ? 'result' : 'error';
|
| 52 |
+
resultDiv.innerHTML = `
|
| 53 |
+
<h4>Response:</h4>
|
| 54 |
+
<pre>${JSON.stringify(data, null, 2)}</pre>
|
| 55 |
+
`;
|
| 56 |
} catch (error) {
|
| 57 |
+
resultDiv.className = 'error';
|
| 58 |
+
resultDiv.innerHTML = `Error: ${error.message}`;
|
| 59 |
}
|
| 60 |
}
|
| 61 |
|
| 62 |
+
async function testDirect() {
|
| 63 |
+
const resultDiv = document.getElementById('directResult');
|
| 64 |
+
|
| 65 |
try {
|
| 66 |
+
const response = await fetch('/');
|
| 67 |
+
const data = await response.json();
|
| 68 |
+
resultDiv.className = 'result';
|
| 69 |
+
resultDiv.innerHTML = `
|
| 70 |
+
<h4>API Status:</h4>
|
| 71 |
+
<pre>${JSON.stringify(data, null, 2)}</pre>
|
| 72 |
+
`;
|
| 73 |
} catch (error) {
|
| 74 |
+
resultDiv.className = 'error';
|
| 75 |
+
resultDiv.innerHTML = `Error: ${error.message}`;
|
| 76 |
}
|
| 77 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
</script>
|
| 79 |
</body>
|
| 80 |
</html>
|