mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Fix for image generation to go to horde if the stable diffusion model isn't downloaded
This commit is contained in:
@@ -8396,7 +8396,7 @@ def generate_image_in_background():
|
||||
|
||||
#If we don't have a GPU, use horde if we're allowed to
|
||||
start_time = time.time()
|
||||
if (not koboldai_vars.hascuda and koboldai_vars.img_gen_priority != 0) or koboldai_vars.img_gen_priority == 3:
|
||||
if ((not koboldai_vars.hascuda or not os.path.exists("models/stable-diffusion-v1-4")) and koboldai_vars.img_gen_priority != 0) or koboldai_vars.img_gen_priority == 3:
|
||||
b64_data = text2img_horde(", ".join(keys), art_guide = art_guide)
|
||||
else:
|
||||
import psutil
|
||||
@@ -8426,7 +8426,7 @@ def text2img_local(prompt, art_guide="", filename="new.png"):
|
||||
import base64
|
||||
from io import BytesIO
|
||||
if koboldai_vars.image_pipeline is None:
|
||||
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, cache="./stable-diffusion-v1-4").to("cuda")
|
||||
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, cache="models/stable-diffusion-v1-4").to("cuda")
|
||||
else:
|
||||
pipe = koboldai_vars.image_pipeline.to("cuda")
|
||||
logger.debug("time to load: {}".format(time.time() - start_time))
|
||||
|
@@ -2321,6 +2321,21 @@ function retry_from_here() {
|
||||
}
|
||||
}
|
||||
|
||||
function push_to_clipboard() {
|
||||
navigator.permissions.query({name: "clipboard-write"}).then((result) => {
|
||||
if (result.state === "granted" || result.state === "prompt") {
|
||||
navigator.clipboard.writeText(getSelectionText());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function push_from_clipboard(el = document.activeElement) {
|
||||
const [start, end] = [el.selectionStart, el.selectionEnd];
|
||||
navigator.clipboard.readText().then(
|
||||
(clipText) => el.setRangeText(clipText, start, end, 'select'));
|
||||
|
||||
}
|
||||
|
||||
function getSelectionText() {
|
||||
var text = "";
|
||||
var activeEl = document.activeElement;
|
||||
|
Reference in New Issue
Block a user