This commit is contained in:
Dobromir Popov
2025-11-22 19:46:28 +02:00
parent afc55b5208
commit cb0d307775
4 changed files with 87 additions and 51 deletions

View File

@@ -99,6 +99,12 @@
function renderAnnotationsList(annotations) {
const listContainer = document.getElementById('annotations-list');
const noAnnotationsMsg = document.getElementById('no-annotations-msg');
const annotationCountEl = document.getElementById('annotation-count');
// Update count immediately
if (annotationCountEl) {
annotationCountEl.textContent = annotations.length;
}
if (annotations.length === 0) {
noAnnotationsMsg.style.display = 'block';
@@ -196,9 +202,6 @@
listContainer.appendChild(item);
});
// Update annotation count
document.getElementById('annotation-count').textContent = annotations.length;
}
function viewAnnotation(annotation) {

View File

@@ -78,18 +78,20 @@
</select>
</div>
<button class="btn btn-success btn-sm w-100" id="start-inference-btn">
<i class="fas fa-play"></i>
Start Live Inference (No Training)
</button>
<button class="btn btn-info btn-sm w-100 mt-1" id="start-inference-pivot-btn">
<i class="fas fa-chart-line"></i>
Live Inference + Pivot Training
</button>
<button class="btn btn-primary btn-sm w-100 mt-1" id="start-inference-candle-btn">
<i class="fas fa-graduation-cap"></i>
Live Inference + Per-Candle Training
</button>
<div id="inference-buttons-container">
<button class="btn btn-success btn-sm w-100" id="start-inference-btn">
<i class="fas fa-play"></i>
Start Live Inference (No Training)
</button>
<button class="btn btn-info btn-sm w-100 mt-1" id="start-inference-pivot-btn">
<i class="fas fa-chart-line"></i>
Live Inference + Pivot Training
</button>
<button class="btn btn-primary btn-sm w-100 mt-1" id="start-inference-candle-btn">
<i class="fas fa-graduation-cap"></i>
Live Inference + Per-Candle Training
</button>
</div>
<button class="btn btn-danger btn-sm w-100 mt-1" id="stop-inference-btn" style="display: none;">
<i class="fas fa-stop"></i>
Stop Inference
@@ -294,18 +296,26 @@
}
function updateButtonState() {
const modelSelect = document.getElementById('model-select');
const trainBtn = document.getElementById('train-model-btn');
const loadBtn = document.getElementById('load-model-btn');
const inferenceBtn = document.getElementById('start-inference-btn');
// Get UI elements
const ui = {
modelSelect: document.getElementById('model-select'),
trainBtn: document.getElementById('train-model-btn'),
loadBtn: document.getElementById('load-model-btn'),
inferenceContainer: document.getElementById('inference-buttons-container')
};
selectedModel = modelSelect.value;
selectedModel = ui.modelSelect.value;
// Helper to set all buttons in container
const setInferenceButtonsState = (disabled) => {
ui.inferenceContainer.querySelectorAll('button').forEach(btn => btn.disabled = disabled);
};
if (!selectedModel) {
// No model selected
trainBtn.style.display = 'none';
loadBtn.style.display = 'none';
inferenceBtn.disabled = true;
// No model selected - disable all inference buttons
ui.trainBtn.style.display = 'none';
ui.loadBtn.style.display = 'none';
setInferenceButtonsState(true);
return;
}
@@ -313,15 +323,15 @@
const modelState = modelStates.find(m => m.name === selectedModel);
if (modelState && modelState.loaded) {
// Model is loaded - show train/inference buttons
trainBtn.style.display = 'block';
loadBtn.style.display = 'none';
inferenceBtn.disabled = false;
// Model is loaded - enable all buttons
ui.trainBtn.style.display = 'block';
ui.loadBtn.style.display = 'none';
setInferenceButtonsState(false);
} else {
// Model not loaded - show load button
trainBtn.style.display = 'none';
loadBtn.style.display = 'block';
inferenceBtn.disabled = true;
// Model not loaded - disable all inference buttons
ui.trainBtn.style.display = 'none';
ui.loadBtn.style.display = 'block';
setInferenceButtonsState(true);
}
}