mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-02-02 11:40:05 +01:00
Preserve across restarts the settings for 'use cpu', 'use full precision', 'use turbo'
This commit is contained in:
parent
c5475fb028
commit
a65f8f5d5c
@ -1 +1 @@
|
|||||||
installer\Scripts\activate.bat
|
installer\Scripts\activate.bat
|
||||||
|
@ -1 +1 @@
|
|||||||
./installer/bin/activate
|
./installer/bin/activate
|
||||||
|
@ -27,4 +27,4 @@
|
|||||||
@xcopy sd-ui-files\ui ui /s /i /Y
|
@xcopy sd-ui-files\ui ui /s /i /Y
|
||||||
@xcopy sd-ui-files\scripts scripts /s /i /Y
|
@xcopy sd-ui-files\scripts scripts /s /i /Y
|
||||||
|
|
||||||
@call scripts\on_sd_start.bat
|
@call scripts\on_sd_start.bat
|
||||||
|
@ -26,4 +26,4 @@ fi
|
|||||||
cp -Rf sd-ui-files/ui ui
|
cp -Rf sd-ui-files/ui ui
|
||||||
cp -Rf sd-ui-files/scripts scripts
|
cp -Rf sd-ui-files/scripts scripts
|
||||||
|
|
||||||
./scripts/on_sd_start.sh
|
./scripts/on_sd_start.sh
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
<li><input id="sound_toggle" name="sound_toggle" type="checkbox" checked> <label for="sound_toggle">Play sound on task completion</label></li>
|
<li><input id="sound_toggle" name="sound_toggle" type="checkbox" checked> <label for="sound_toggle">Play sound on task completion</label></li>
|
||||||
<li><input id="turbo" name="turbo" type="checkbox" checked> <label for="turbo">Turbo mode (generates images faster, but uses an additional 1 GB of GPU memory)</label></li>
|
<li><input id="turbo" name="turbo" type="checkbox" checked> <label for="turbo">Turbo mode (generates images faster, but uses an additional 1 GB of GPU memory)</label></li>
|
||||||
<li><input id="use_cpu" name="use_cpu" type="checkbox"> <label for="use_cpu">Use CPU instead of GPU (warning: this will be *very* slow)</label></li>
|
<li><input id="use_cpu" name="use_cpu" type="checkbox"> <label for="use_cpu">Use CPU instead of GPU (warning: this will be *very* slow)</label></li>
|
||||||
<li><input id="use_full_precision" name="use_full_precision" type="checkbox"> <label for="use_full_precision">Use full precision (for GPU-only. warning: this will consume more VRAM)</label></li>
|
<li><input id="use_full_precision" name="use_full_precision" type="checkbox"> <label for="use_full_precision">Use full precision (for GPU-only. warning: this will consume more VRAM. Use this for NVIDIA 1650 and 1660)</label></li>
|
||||||
<!-- <li><input id="allow_nsfw" name="allow_nsfw" type="checkbox"> <label for="allow_nsfw">Allow NSFW Content (You confirm you are above 18 years of age)</label></li> -->
|
<!-- <li><input id="allow_nsfw" name="allow_nsfw" type="checkbox"> <label for="allow_nsfw">Allow NSFW Content (You confirm you are above 18 years of age)</label></li> -->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -343,6 +343,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const SOUND_ENABLED_KEY = "soundEnabled"
|
const SOUND_ENABLED_KEY = "soundEnabled"
|
||||||
|
const USE_CPU_KEY = "useCPU"
|
||||||
|
const USE_FULL_PRECISION_KEY = "useFullPrecision"
|
||||||
|
const USE_TURBO_MODE_KEY = "useTurboMode"
|
||||||
const HEALTH_PING_INTERVAL = 5 // seconds
|
const HEALTH_PING_INTERVAL = 5 // seconds
|
||||||
|
|
||||||
let promptField = document.querySelector('#prompt')
|
let promptField = document.querySelector('#prompt')
|
||||||
@ -396,11 +399,44 @@ let serverStatusMsg = document.querySelector('#server-status-msg')
|
|||||||
let serverStatus = 'offline'
|
let serverStatus = 'offline'
|
||||||
let activeTags = []
|
let activeTags = []
|
||||||
|
|
||||||
function isSoundEnabled() {
|
function getLocalStorageItem(key, fallback) {
|
||||||
if (localStorage.getItem(SOUND_ENABLED_KEY) === 'false') {
|
let item = localStorage.getItem(key)
|
||||||
return false
|
if (item === null) {
|
||||||
|
return fallback
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLocalStorageBoolItem(key, fallback) {
|
||||||
|
let item = localStorage.getItem(key)
|
||||||
|
if (item === null) {
|
||||||
|
return fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
return (item === 'true' ? true : false)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBoolSettingChange(key) {
|
||||||
|
return function(e) {
|
||||||
|
localStorage.setItem(key, e.target.checked.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSoundEnabled() {
|
||||||
|
return getLocalStorageBoolItem(SOUND_ENABLED_KEY, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isUseCPUEnabled() {
|
||||||
|
return getLocalStorageBoolItem(USE_CPU_KEY, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isUseFullPrecisionEnabled() {
|
||||||
|
return getLocalStorageBoolItem(USE_FULL_PRECISION_KEY, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isUseTurboModeEnabled() {
|
||||||
|
return getLocalStorageBoolItem(USE_TURBO_MODE_KEY, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStatus(statusType, msg, msgType) {
|
function setStatus(statusType, msg, msgType) {
|
||||||
@ -672,22 +708,20 @@ function generateUUID() { // Public Domain/MIT
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAudioEnabledChange(e) {
|
soundToggle.addEventListener('click', handleBoolSettingChange(SOUND_ENABLED_KEY))
|
||||||
localStorage.setItem(SOUND_ENABLED_KEY, e.target.checked.toString())
|
soundToggle.checked = isSoundEnabled()
|
||||||
}
|
|
||||||
|
|
||||||
soundToggle.addEventListener('click', handleAudioEnabledChange)
|
useCPUField.addEventListener('click', handleBoolSettingChange(USE_CPU_KEY))
|
||||||
soundToggle.checked = isSoundEnabled();
|
useCPUField.checked = isUseCPUEnabled()
|
||||||
|
|
||||||
|
useFullPrecisionField.addEventListener('click', handleBoolSettingChange(USE_FULL_PRECISION_KEY))
|
||||||
|
useFullPrecisionField.checked = isUseFullPrecisionEnabled()
|
||||||
|
|
||||||
|
turboField.addEventListener('click', handleBoolSettingChange(USE_TURBO_MODE_KEY))
|
||||||
|
turboField.checked = isUseTurboModeEnabled()
|
||||||
|
|
||||||
makeImageBtn.addEventListener('click', makeImage)
|
makeImageBtn.addEventListener('click', makeImage)
|
||||||
|
|
||||||
// configBox.style.display = 'none'
|
|
||||||
|
|
||||||
// showConfigToggle.addEventListener('click', function() {
|
|
||||||
// configBox.style.display = (configBox.style.display === 'none' ? 'block' : 'none')
|
|
||||||
// showConfigToggle.innerHTML = (configBox.style.display === 'none' ? 'show' : 'hide')
|
|
||||||
// return false
|
|
||||||
// })
|
|
||||||
|
|
||||||
function updateGuidanceScale() {
|
function updateGuidanceScale() {
|
||||||
guidanceScaleValueLabel.innerHTML = guidanceScaleField.value / 10
|
guidanceScaleValueLabel.innerHTML = guidanceScaleField.value / 10
|
||||||
|
Loading…
Reference in New Issue
Block a user