Spaces:
Running
Running
feat(studio): simplify UI by standardizing on DBNet text segmentation
Browse filesFiles changed (3)
- Dockerfile+1-1
- ocr-studio/app.py+1-1
- ocr-studio/index.html+2-66
18 unmodified lines1920212223242518 unmodified linesRUN pip install --no-cache-dir -r requirements.txt# Force cache bust for updated app code & V24 modelRUN echo "Cache bust 2026-09-09T07:56:30Z"# Copy application filesCOPY . /app18 unmodified lines1920212223242518 unmodified linesRUN pip install --no-cache-dir -r requirements.txt# Force cache bust for updated app code & V24 modelRUN echo "Cache bust 2026-09-09T08:12:40Z"# Copy application filesCOPY . /app
1372 unmodified lines13731374137513761377137813791372 unmodified lines# Extract parametersimg_b64 = data['image']model_ver = data.get('model', 'v24')method = data.get('method', 'valley')threshold = float(data.get('threshold', 0.05))gap = int(data.get('gap', 12))win = int(data.get('window', 25))1372 unmodified lines13731374137513761377137813791372 unmodified lines# Extract parametersimg_b64 = data['image']model_ver = data.get('model', 'v24')method = data.get('method', 'dbnet')threshold = float(data.get('threshold', 0.05))gap = int(data.get('gap', 12))win = int(data.get('window', 25))
809 unmodified lines810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842426 unmodified lines1269127012711272127312741275645 unmodified lines19211922192319241925192619271928192919301931193219331934428 unmodified lines23632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400809 unmodified lines</optgroup></select></div><!-- Collapsible Advanced Settings --><div class="collapsible-trigger" onclick="toggleAdvancedSettings()"><span id="adv-arrow">▶</span> Cấu hình nâng cao</div><div class="collapsible-content" id="advanced-settings-content"><div class="form-group"><label>Thuật toán Phân đoạn</label><select id="method-select" class="form-select" onchange="toggleMethodControls()"><option value="dbnet" selected>PaddleOCR DBNet (Tranh ảnh / Nền phức tạp)</option><option value="valley">Valley Detection (Tài liệu scan/Sách phẳng)</option><option value="adaptive">Adaptive Threshold</option></select></div><div class="form-group" id="group-threshold" style="display: none;"><label>Ngưỡng nhị phân (Threshold)</label><input type="number" id="threshold-input" class="form-input" value="0.05" step="0.01" min="0.01" max="0.5"></div><div class="form-group" id="group-gap" style="display: none;"><label>Khoảng cách dòng tối thiểu (px)</label><input type="number" id="gap-input" class="form-input" value="12" min="1" max="100"></div><div class="form-group" id="group-window" style="display: none;"><label>Kích thước cửa sổ (Valley Window)</label><input type="number" id="window-input" class="form-input" value="25" min="5" max="100"></div></div></div><!-- Queue list -->426 unmodified linesdocument.addEventListener('DOMContentLoaded', () => {loadQueueFromStorage();updateModelBadge();toggleMethodControls();});// -------------------------------------------------------------645 unmodified linesconst payload = {image: currentImageBase64,model: modelSelect.value,method: document.getElementById('method-select').value,threshold: document.getElementById('threshold-input').value,gap: document.getElementById('gap-input').value,window: document.getElementById('window-input').value};appendLog(`Khởi chạy OCR với mô hình: ${modelSelect.value}, thuật toán: ${payload.method}`, 'info');appendLog(`Tham số: threshold=${payload.threshold}, gap=${payload.gap}, window=${payload.window}`, 'info');fetch('/ocr', {method: 'POST',428 unmodified lines// -------------------------------------------------------------// Helper Utils// -------------------------------------------------------------function toggleAdvancedSettings() {const content = document.getElementById('advanced-settings-content');const arrow = document.getElementById('adv-arrow');content.classList.toggle('open');if (content.classList.contains('open')) {arrow.innerText = "▼";} else {arrow.innerText = "▶";}}function toggleMethodControls() {const method = document.getElementById('method-select').value;const groupThreshold = document.getElementById('group-threshold');const groupWindow = document.getElementById('group-window');const groupGap = document.getElementById('group-gap');if (method === 'dbnet') {if (groupThreshold) groupThreshold.style.display = 'none';if (groupWindow) groupWindow.style.display = 'none';if (groupGap) groupGap.style.display = 'none';} else if (method === 'adaptive') {if (groupThreshold) groupThreshold.style.display = 'flex';if (groupWindow) groupWindow.style.display = 'none';if (groupGap) groupGap.style.display = 'flex';} else {if (groupThreshold) groupThreshold.style.display = 'none';if (groupWindow) groupWindow.style.display = 'flex';if (groupGap) groupGap.style.display = 'flex';}}function updateModelBadge() {const ver = document.getElementById('model-select').value;document.getElementById('active-model-badge').innerText = ver;809 unmodified lines810811812813814815426 unmodified lines124212431244124512461247645 unmodified lines1893189418951896189718981899190019011902428 unmodified lines233123322333233423352336809 unmodified lines</optgroup></select></div></div><!-- Queue list -->426 unmodified linesdocument.addEventListener('DOMContentLoaded', () => {loadQueueFromStorage();updateModelBadge();});// -------------------------------------------------------------645 unmodified linesconst payload = {image: currentImageBase64,model: modelSelect.value,method: 'dbnet'};appendLog(`Khởi chạy OCR với mô hình: ${modelName} (Phân đoạn DBNet tự động)`, 'info');fetch('/ocr', {method: 'POST',428 unmodified lines// -------------------------------------------------------------// Helper Utils// -------------------------------------------------------------function updateModelBadge() {const ver = document.getElementById('model-select').value;document.getElementById('active-model-badge').innerText = ver;
Dockerfile+1-1
ocr-studio/app.py+1-1
ocr-studio/index.html+2-66