Compare commits

...

6 Commits
v1.21 ... v1.22

Author SHA1 Message Date
cmdr2
75a9466232 Avoid running a background task in ./server, seems to be causing issues on some distros 2022-08-27 00:25:49 +05:30
cmdr2
2ffe7cc843 Merge branch 'main' of github.com:cmdr2/stable-diffusion-ui 2022-08-27 00:20:32 +05:30
cmdr2
d111911c18 Button to download the generated image 2022-08-27 00:20:20 +05:30
cmdr2
d55935f8c0 Update README.md 2022-08-26 22:53:42 +05:30
cmdr2
4def55368c Troubleshooting: use the latest WSL kernel 2022-08-26 22:36:44 +05:30
cmdr2
661eff90fc Use the latest Stable Diffusion model 2022-08-26 22:31:08 +05:30
4 changed files with 39 additions and 19 deletions

View File

@@ -30,7 +30,7 @@ All the processing will happen on your computer locally, it does not transmit yo
2. Open your terminal, and in the project directory run: `./server` (warning: this will take some time during the first run, since it'll download Stable Diffusion's [docker image](https://replicate.com/stability-ai/stable-diffusion), nearly 17 GiB) 2. Open your terminal, and in the project directory run: `./server` (warning: this will take some time during the first run, since it'll download Stable Diffusion's [docker image](https://replicate.com/stability-ai/stable-diffusion), nearly 17 GiB)
3. Open http://localhost:9000 in your browser. That's it! 3. Open http://localhost:9000 in your browser. That's it!
If you're getting errors, please check the [Troubleshooting](#troubleshooting) section below. If you're getting errors, please check the [Troubleshooting](https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting) page.
To stop the server, please run `./server stop` To stop the server, please run `./server stop`
@@ -64,21 +64,7 @@ Use the same `seed` number to get the same image for a certain prompt. This is u
![Screenshot of advanced settings](media/config-v2.jpg?raw=true) ![Screenshot of advanced settings](media/config-v2.jpg?raw=true)
# Troubleshooting # Troubleshooting
## './docker-compose.yml' is invalid: The [Troubleshooting wiki page](https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting) contains some common errors and their solutions. Please check that, and if it doesn't work, feel free to [file an issue](https://github.com/cmdr2/stable-diffusion-ui/issues).
> ERROR: The Compose file './docker-compose.yml' is invalid because:
> services.stability-ai.deploy.resources.reservations value Additional properties are not allowed ('devices' was unexpected)
Please ensure you have `docker-compose` version 1.29 or higher. Check `docker-compose --version`, and if required [update it to 1.29](https://docs.docker.com/compose/install/). (Thanks [HVRyan](https://github.com/HVRyan))
## RuntimeError: Found no NVIDIA driver on your system:
If you have an NVIDIA GPU and the latest [NVIDIA driver](http://www.nvidia.com/Download/index.aspx), please ensure that you've installed [nvidia-container-toolkit](https://stackoverflow.com/a/58432877). (Thanks [u/exintrovert420](https://www.reddit.com/user/exintrovert420/))
## Some other process is already running at port 9000 / port 9000 could not be bound
You can override the port used. Please change `docker-compose.yml` inside the project directory, and update the line `9000:9000` to `1337:9000` (where 1337 is whichever port number you want).
After doing this, please restart your server, by running `./server restart`.
After this, you can access the server at `http://localhost:1337` (where 1337 is the new port you specified earlier).
# Behind the scenes # Behind the scenes
This project is a quick way to get started with Stable Diffusion. You do not need to have Stable Diffusion already installed, and do not need any API keys. This project will automatically download Stable Diffusion's docker image, the first time it is run. This project is a quick way to get started with Stable Diffusion. You do not need to have Stable Diffusion already installed, and do not need any API keys. This project will automatically download Stable Diffusion's docker image, the first time it is run.

View File

@@ -5,7 +5,7 @@ services:
container_name: sd container_name: sd
ports: ports:
- '5000:5000' - '5000:5000'
image: 'r8.im/stability-ai/stable-diffusion@sha256:3080f37ef32771c9984d65033cbe71caa96c69680008bae64cf691724a6df04c' image: 'r8.im/stability-ai/stable-diffusion@sha256:be04660a5b93ef2aff61e3668dedb4cbeb14941e62a3fd5998364a32d613e35e'
deploy: deploy:
resources: resources:
reservations: reservations:

View File

@@ -72,6 +72,12 @@
margin-top: 5pt; margin-top: 5pt;
margin-left: -5pt; margin-left: -5pt;
} }
.imgSaveBtn {
position: absolute;
transform: translateX(-100%);
margin-top: 30pt;
margin-left: -5pt;
}
.imgItem { .imgItem {
display: inline; display: inline;
padding-right: 10px; padding-right: 10px;
@@ -328,8 +334,13 @@ async function makeImage() {
imgUseBtn.className = 'imgUseBtn' imgUseBtn.className = 'imgUseBtn'
imgUseBtn.innerHTML = 'Use as Input' imgUseBtn.innerHTML = 'Use as Input'
let imgSaveBtn = document.createElement('button')
imgSaveBtn.className = 'imgSaveBtn'
imgSaveBtn.innerHTML = 'Download'
imgItem.appendChild(img) imgItem.appendChild(img)
imgItem.appendChild(imgUseBtn) imgItem.appendChild(imgUseBtn)
imgItem.appendChild(imgSaveBtn)
imagesContainer.appendChild(imgItem) imagesContainer.appendChild(imgItem)
imgUseBtn.addEventListener('click', function() { imgUseBtn.addEventListener('click', function() {
@@ -345,6 +356,13 @@ async function makeImage() {
seedField.value = seed seedField.value = seed
seedField.disabled = false seedField.disabled = false
}) })
imgSaveBtn.addEventListener('click', function() {
let imgDownload = document.createElement('a')
imgDownload.download = generateUUID() + '.png'
imgDownload.href = imgBody
imgDownload.click()
})
} }
setStatus('request', 'done', 'success') setStatus('request', 'done', 'success')
@@ -354,6 +372,22 @@ async function makeImage() {
} }
} }
function generateUUID() { // Public Domain/MIT
var d = new Date().getTime();//Timestamp
var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now()*1000)) || 0;//Time in microseconds since page-load or 0 if unsupported
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16;//random number between 0 and 16
if(d > 0){//Use timestamp until depleted
r = (d + r)%16 | 0;
d = Math.floor(d/16);
} else {//Use microseconds since page-load if supported
r = (d2 + r)%16 | 0;
d2 = Math.floor(d2/16);
}
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
}
function handleAudioEnabledChange(e) { function handleAudioEnabledChange(e) {
localStorage.setItem(SOUND_ENABLED_KEY, e.target.checked.toString()) localStorage.setItem(SOUND_ENABLED_KEY, e.target.checked.toString())
} }

4
server
View File

@@ -6,8 +6,8 @@ if [ -z "$1" ]; then
fi fi
start_server() { start_server() {
docker-compose up -d stable-diffusion-old-port-redirect > /dev/null 2>&1 # old port 8000 server, show redirect notice docker-compose up -d stable-diffusion-old-port-redirect # old port 8000 server, show redirect notice
docker-compose up stability-ai stable-diffusion-ui & docker-compose up stability-ai stable-diffusion-ui
} }
stop_server() { stop_server() {