Spaces:
Running on Zero
Running on Zero
feat: add generation mode toggle, advanced sampling parameters, and a help modal to the UI
Browse files- index.html +105 -18
index.html
CHANGED
|
@@ -224,19 +224,28 @@
|
|
| 224 |
<span class="text-sm font-medium text-white/70">Streaming</span>
|
| 225 |
<div id="streaming-toggle" class="toggle-switch active"></div>
|
| 226 |
</div>
|
|
|
|
| 227 |
<div class="space-y-3">
|
| 228 |
-
<
|
| 229 |
-
|
| 230 |
-
<
|
|
|
|
| 231 |
</div>
|
| 232 |
-
<input type="range" id="temp-slider" min="0" max="2" step="0.01" value="0.7" class="control-slider">
|
| 233 |
</div>
|
|
|
|
| 234 |
<div class="space-y-3">
|
| 235 |
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
| 236 |
<span>Max Tokens</span>
|
| 237 |
-
<span id="tokens-val">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
</div>
|
| 239 |
-
<input type="range" id="
|
| 240 |
</div>
|
| 241 |
<div class="space-y-3">
|
| 242 |
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
|
@@ -245,20 +254,60 @@
|
|
| 245 |
</div>
|
| 246 |
<input type="range" id="p-slider" min="0" max="1" step="0.05" value="0.8" class="control-slider">
|
| 247 |
</div>
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
<button onclick="clearHistory()" class="w-full py-4 rounded-2xl bg-red-500/10 border border-red-500/20 text-red-500 text-sm font-bold hover:bg-red-500/20 transition-all flex items-center justify-center gap-2">
|
| 255 |
<i data-lucide="trash-2" class="w-4 h-4"></i>
|
| 256 |
Clear Conversation
|
| 257 |
</button>
|
| 258 |
</div>
|
|
|
|
| 259 |
|
| 260 |
-
|
| 261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
</div>
|
| 263 |
</div>
|
| 264 |
|
|
@@ -336,11 +385,49 @@
|
|
| 336 |
const streamingToggle = document.getElementById('streaming-toggle');
|
| 337 |
const tempSlider = document.getElementById('temp-slider');
|
| 338 |
const tokensSlider = document.getElementById('tokens-slider');
|
|
|
|
| 339 |
const pSlider = document.getElementById('p-slider');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
|
|
|
|
|
|
| 344 |
let chatHistory = [];
|
| 345 |
let currentJob = null;
|
| 346 |
|
|
@@ -549,8 +636,8 @@
|
|
| 549 |
max_new_tokens: parseInt(tokensSlider.value),
|
| 550 |
temperature: parseFloat(tempSlider.value),
|
| 551 |
top_p: parseFloat(pSlider.value),
|
| 552 |
-
top_k:
|
| 553 |
-
max_frames:
|
| 554 |
});
|
| 555 |
|
| 556 |
let finalAnswer = "";
|
|
|
|
| 224 |
<span class="text-sm font-medium text-white/70">Streaming</span>
|
| 225 |
<div id="streaming-toggle" class="toggle-switch active"></div>
|
| 226 |
</div>
|
| 227 |
+
|
| 228 |
<div class="space-y-3">
|
| 229 |
+
<span class="text-xs font-bold text-white/40 uppercase tracking-widest">Generation Mode</span>
|
| 230 |
+
<div class="flex gap-2 p-1 bg-white/5 rounded-xl border border-white/10">
|
| 231 |
+
<button id="mode-sampling" class="flex-1 py-2 text-xs font-bold rounded-lg bg-white/10 text-white transition-all">Sampling</button>
|
| 232 |
+
<button id="mode-beam" class="flex-1 py-2 text-xs font-bold rounded-lg text-white/40 hover:text-white transition-all">Beam Search</button>
|
| 233 |
</div>
|
|
|
|
| 234 |
</div>
|
| 235 |
+
|
| 236 |
<div class="space-y-3">
|
| 237 |
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
| 238 |
<span>Max Tokens</span>
|
| 239 |
+
<span id="tokens-val">2048</span>
|
| 240 |
+
</div>
|
| 241 |
+
<input type="range" id="tokens-slider" min="64" max="16384" step="64" value="2048" class="control-slider">
|
| 242 |
+
</div>
|
| 243 |
+
<div class="space-y-3">
|
| 244 |
+
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
| 245 |
+
<span>Temperature</span>
|
| 246 |
+
<span id="temp-val">0.7</span>
|
| 247 |
</div>
|
| 248 |
+
<input type="range" id="temp-slider" min="0" max="2" step="0.01" value="0.7" class="control-slider">
|
| 249 |
</div>
|
| 250 |
<div class="space-y-3">
|
| 251 |
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
|
|
|
| 254 |
</div>
|
| 255 |
<input type="range" id="p-slider" min="0" max="1" step="0.05" value="0.8" class="control-slider">
|
| 256 |
</div>
|
| 257 |
+
<div class="space-y-3">
|
| 258 |
+
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
| 259 |
+
<span>Top-K</span>
|
| 260 |
+
<span id="k-val">100</span>
|
| 261 |
+
</div>
|
| 262 |
+
<input type="range" id="k-slider" min="0" max="200" step="1" value="100" class="control-slider">
|
| 263 |
+
</div>
|
| 264 |
+
<div class="space-y-3">
|
| 265 |
+
<div class="flex justify-between text-xs font-bold text-white/40 uppercase tracking-widest">
|
| 266 |
+
<span>Max Frames</span>
|
| 267 |
+
<span id="frames-val">64</span>
|
| 268 |
+
</div>
|
| 269 |
+
<input type="range" id="frames-slider" min="8" max="256" step="8" value="64" class="control-slider">
|
| 270 |
+
</div>
|
| 271 |
|
| 272 |
<button onclick="clearHistory()" class="w-full py-4 rounded-2xl bg-red-500/10 border border-red-500/20 text-red-500 text-sm font-bold hover:bg-red-500/20 transition-all flex items-center justify-center gap-2">
|
| 273 |
<i data-lucide="trash-2" class="w-4 h-4"></i>
|
| 274 |
Clear Conversation
|
| 275 |
</button>
|
| 276 |
</div>
|
| 277 |
+
</div>
|
| 278 |
|
| 279 |
+
<!-- Help Modal -->
|
| 280 |
+
<div id="help-modal" class="fixed inset-0 z-[200] flex items-center justify-center bg-black/80 backdrop-blur-sm hidden p-6">
|
| 281 |
+
<div class="max-w-4xl w-full bg-[#0D1117] border border-white/10 rounded-[32px] overflow-hidden shadow-2xl flex flex-col max-h-[90vh]">
|
| 282 |
+
<div class="p-8 border-b border-white/10 flex items-center justify-between">
|
| 283 |
+
<h2 class="text-2xl font-bold">How to use MiniCPM-V 4.6</h2>
|
| 284 |
+
<button id="close-help" class="text-white/40 hover:text-white"><i data-lucide="x" class="w-6 h-6"></i></button>
|
| 285 |
+
</div>
|
| 286 |
+
<div class="p-8 overflow-y-auto space-y-12">
|
| 287 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 288 |
+
<div class="space-y-4">
|
| 289 |
+
<div class="aspect-video bg-white/5 rounded-2xl overflow-hidden border border-white/5">
|
| 290 |
+
<img src="http://thunlp.oss-cn-qingdao.aliyuncs.com/multi_modal/never_delete/m_bear2.gif" class="w-full h-full object-cover">
|
| 291 |
+
</div>
|
| 292 |
+
<h3 class="font-bold text-lg">1. Multi-Image Chat</h3>
|
| 293 |
+
<p class="text-sm text-white/50 leading-relaxed">Upload multiple images at once. Use the "+" button to select files or drag them into the input area.</p>
|
| 294 |
+
</div>
|
| 295 |
+
<div class="space-y-4">
|
| 296 |
+
<div class="aspect-video bg-white/5 rounded-2xl overflow-hidden border border-white/5">
|
| 297 |
+
<img src="http://thunlp.oss-cn-qingdao.aliyuncs.com/multi_modal/never_delete/video2.gif" class="w-full h-full object-cover">
|
| 298 |
+
</div>
|
| 299 |
+
<h3 class="font-bold text-lg">2. Video Intelligence</h3>
|
| 300 |
+
<p class="text-sm text-white/50 leading-relaxed">Upload videos for temporal reasoning. MiniCPM-V will sample frames and describe events over time.</p>
|
| 301 |
+
</div>
|
| 302 |
+
<div class="space-y-4">
|
| 303 |
+
<div class="aspect-video bg-white/5 rounded-2xl overflow-hidden border border-white/5">
|
| 304 |
+
<img src="http://thunlp.oss-cn-qingdao.aliyuncs.com/multi_modal/never_delete/fshot.gif" class="w-full h-full object-cover">
|
| 305 |
+
</div>
|
| 306 |
+
<h3 class="font-bold text-lg">3. Few-Shot Learning</h3>
|
| 307 |
+
<p class="text-sm text-white/50 leading-relaxed">Provide examples to guide the model. Add turns with correct answers to teach the model a specific style.</p>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
</div>
|
| 311 |
</div>
|
| 312 |
</div>
|
| 313 |
|
|
|
|
| 385 |
const streamingToggle = document.getElementById('streaming-toggle');
|
| 386 |
const tempSlider = document.getElementById('temp-slider');
|
| 387 |
const tokensSlider = document.getElementById('tokens-slider');
|
| 388 |
+
const tokensVal = document.getElementById('tokens-val');
|
| 389 |
const pSlider = document.getElementById('p-slider');
|
| 390 |
+
const pVal = document.getElementById('p-val');
|
| 391 |
+
const kSlider = document.getElementById('k-slider');
|
| 392 |
+
const kVal = document.getElementById('k-val');
|
| 393 |
+
const framesSlider = document.getElementById('frames-slider');
|
| 394 |
+
const framesVal = document.getElementById('frames-val');
|
| 395 |
+
const modeSampling = document.getElementById('mode-sampling');
|
| 396 |
+
const modeBeam = document.getElementById('mode-beam');
|
| 397 |
+
const helpModal = document.getElementById('help-modal');
|
| 398 |
+
const closeHelp = document.getElementById('close-help');
|
| 399 |
+
|
| 400 |
+
let generationMode = 'Sampling';
|
| 401 |
+
|
| 402 |
+
modeSampling.onclick = () => {
|
| 403 |
+
generationMode = 'Sampling';
|
| 404 |
+
modeSampling.classList.add('bg-white/10');
|
| 405 |
+
modeSampling.classList.remove('text-white/40');
|
| 406 |
+
modeBeam.classList.remove('bg-white/10');
|
| 407 |
+
modeBeam.classList.add('text-white/40');
|
| 408 |
+
};
|
| 409 |
+
|
| 410 |
+
modeBeam.onclick = () => {
|
| 411 |
+
generationMode = 'Beam Search';
|
| 412 |
+
modeBeam.classList.add('bg-white/10');
|
| 413 |
+
modeBeam.classList.remove('text-white/40');
|
| 414 |
+
modeSampling.classList.remove('bg-white/10');
|
| 415 |
+
modeSampling.classList.add('text-white/40');
|
| 416 |
+
// Disable streaming toggle for beam search parity
|
| 417 |
+
if (streamingToggle.classList.contains('active')) {
|
| 418 |
+
streamingToggle.click();
|
| 419 |
+
}
|
| 420 |
+
};
|
| 421 |
+
|
| 422 |
+
// Help Modal Logic
|
| 423 |
+
window.openHelp = () => helpModal.classList.remove('hidden');
|
| 424 |
+
closeHelp.onclick = () => helpModal.classList.add('hidden');
|
| 425 |
|
| 426 |
+
tempSlider.oninput = () => tempVal.textContent = tempSlider.value;
|
| 427 |
+
tokensSlider.oninput = () => tokensVal.textContent = tokensSlider.value;
|
| 428 |
+
pSlider.oninput = () => pVal.textContent = pSlider.value;
|
| 429 |
+
kSlider.oninput = () => kVal.textContent = kSlider.value;
|
| 430 |
+
framesSlider.oninput = () => framesVal.textContent = framesSlider.value;
|
| 431 |
let chatHistory = [];
|
| 432 |
let currentJob = null;
|
| 433 |
|
|
|
|
| 636 |
max_new_tokens: parseInt(tokensSlider.value),
|
| 637 |
temperature: parseFloat(tempSlider.value),
|
| 638 |
top_p: parseFloat(pSlider.value),
|
| 639 |
+
top_k: parseInt(kSlider.value),
|
| 640 |
+
max_frames: parseInt(framesSlider.value)
|
| 641 |
});
|
| 642 |
|
| 643 |
let finalAnswer = "";
|