Merge branch 'beta' of github.com:cmdr2/stable-diffusion-ui into beta

This commit is contained in:
cmdr2 2023-08-29 14:54:43 +05:30
commit a21b01a0cd
4 changed files with 38 additions and 19 deletions

2
.github/FUNDING.yml vendored
View File

@ -1,3 +1,3 @@
# These are supported funding model platforms # These are supported funding model platforms
ko_fi: cmdr2_stablediffusion_ui ko_fi: easydiffusion

View File

@ -13,18 +13,21 @@ Does not require technical knowledge, does not require pre-installed software. 1
Click the download button for your operating system: Click the download button for your operating system:
<p float="left"> <p float="left">
<a href="https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.5.41a/Easy-Diffusion-Windows.exe"><img src="https://github.com/cmdr2/stable-diffusion-ui/raw/main/media/download-win.png" width="200" /></a> <a href="https://github.com/cmdr2/stable-diffusion-ui/releases/latest/download/Easy-Diffusion-Linux.zip"><img src="https://github.com/cmdr2/stable-diffusion-ui/raw/main/media/download-linux.png" width="200" /></a>
<a href="https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.5.41a/Easy-Diffusion-Linux.zip"><img src="https://github.com/cmdr2/stable-diffusion-ui/raw/main/media/download-linux.png" width="200" /></a> <a href="https://github.com/cmdr2/stable-diffusion-ui/releases/latest/download/Easy-Diffusion-Mac.zip"><img src="https://github.com/cmdr2/stable-diffusion-ui/raw/main/media/download-mac.png" width="200" /></a>
<a href="https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.5.41a/Easy-Diffusion-Mac.zip"><img src="https://github.com/cmdr2/stable-diffusion-ui/raw/main/media/download-mac.png" width="200" /></a> <a href="https://github.com/cmdr2/stable-diffusion-ui/releases/latest/download/Easy-Diffusion-Windows.exe"><img src="https://github.com/cmdr2/stable-diffusion-ui/raw/main/media/download-win.png" width="200" /></a>
</p> </p>
**Hardware requirements:** **Hardware requirements:**
- **Windows:** NVIDIA graphics card (minimum 2 GB RAM), or run on your CPU. - **Windows:** NVIDIA graphics card¹ (minimum 2 GB RAM), or run on your CPU.
- **Linux:** NVIDIA or AMD graphics card (minimum 2 GB RAM), or run on your CPU. - **Linux:** NVIDIA¹ or AMD² graphics card (minimum 2 GB RAM), or run on your CPU.
- **Mac:** M1 or M2, or run on your CPU. - **Mac:** M1 or M2, or run on your CPU.
- Minimum 8 GB of system RAM. - Minimum 8 GB of system RAM.
- Atleast 25 GB of space on the hard disk. - Atleast 25 GB of space on the hard disk.
¹) [CUDA Compute capability](https://en.wikipedia.org/wiki/CUDA#GPUs_supported) level of 3.7 or higher required.
²) ROCm 5.2 support required.
The installer will take care of whatever is needed. If you face any problems, you can join the friendly [Discord community](https://discord.com/invite/u9yhsFmEkB) and ask for assistance. The installer will take care of whatever is needed. If you face any problems, you can join the friendly [Discord community](https://discord.com/invite/u9yhsFmEkB) and ask for assistance.

View File

@ -678,6 +678,29 @@ function getAllModelNames(type) {
return f(modelsOptions[type]) return f(modelsOptions[type])
} }
// gets a flattened list of all models of a certain type. e.g. "path/subpath/modelname"
// use the filter to search for all models having a certain name.
function getAllModelPathes(type,filter="") {
function f(tree, prefix) {
if (tree == undefined) {
return []
}
let result = []
tree.forEach((e) => {
if (typeof e == "object") {
result = result.concat(f(e[1], prefix + e[0] + "/"))
} else {
if (filter=="" || e==filter) {
result.push(prefix + e)
}
}
})
return result
}
return f(modelsOptions[type], "")
}
function onUseAsThumbnailClick(req, img) { function onUseAsThumbnailClick(req, img) {
let scale = 1 let scale = 1
let targetWidth = img.naturalWidth let targetWidth = img.naturalWidth

View File

@ -29,22 +29,13 @@
let modelWeights = LoRA.map(e => e.lora_alpha_0) let modelWeights = LoRA.map(e => e.lora_alpha_0)
loraModelField.value = {modelNames: modelNames, modelWeights: modelWeights} loraModelField.value = {modelNames: modelNames, modelWeights: modelWeights}
showToast("Prompt successfully processed", LoRA[0].lora_model_0); showToast("Prompt successfully processed")
} }
//promptField.dispatchEvent(new Event('change')); //promptField.dispatchEvent(new Event('change'));
}); });
function isModelAvailable(array, searchString) {
const foundItem = array.find(function(item) {
item = item.toString().toLowerCase();
return item === searchString.toLowerCase()
});
return foundItem || "";
}
// extract LoRA tags from strings // extract LoRA tags from strings
function extractLoraTags(prompt) { function extractLoraTags(prompt) {
// Define the regular expression for the tags // Define the regular expression for the tags
@ -55,11 +46,13 @@
// Iterate over the string, finding matches // Iterate over the string, finding matches
for (const match of prompt.matchAll(regex)) { for (const match of prompt.matchAll(regex)) {
const modelFileName = isModelAvailable(modelsCache.options.lora, match[1].trim()) const modelFileName = match[1].trim()
if (modelFileName !== "") { const loraPathes = getAllModelPathes("lora", modelFileName)
if (loraPathes.length > 0) {
const loraPath = loraPathes[0]
// Initialize an object to hold a match // Initialize an object to hold a match
let loraTag = { let loraTag = {
lora_model_0: modelFileName, lora_model_0: loraPath,
} }
//console.log("Model:" + modelFileName); //console.log("Model:" + modelFileName);