diff --git a/webui/app.py b/webui/app.py index d240a3729..6b1b4de4b 100644 --- a/webui/app.py +++ b/webui/app.py @@ -662,12 +662,33 @@ def load_model(): except Exception as e: return jsonify({'error': f'Model loading failed: {str(e)}'}), 500 +def recommended_device(): + """Best device actually present on this machine. + + The UI's is authored CPU-first, so on an Apple Silicon Mac the + // default silently ignored the GPU; the server detects the device + // because only it can see what torch was built against. + function applyRecommendedDevice(device) { + if (!device) return; + const select = document.getElementById('device-select'); + const match = Array.from(select.options).find(o => o.value === device); + if (!match) return; + select.value = device; + const hint = select.parentElement.querySelector('.form-text'); + if (hint) { + hint.textContent = `Select the device to run the model on (detected: ${match.textContent})`; + } + } + // Populate model selection dropdown function populateModelSelect() { const modelSelect = document.getElementById('model-select');