Commit Graph

43 Commits

Author SHA1 Message Date
hlky
b650c162e6
src->models 2022-10-05 01:03:06 +01:00
hlky
3851fcc537
model manager
model manager
2022-10-04 19:39:52 +01:00
Divided by Zer0
e33d093fa8
Added batch/shell script to explicitly start the stable horde bridge (#1413)
So that people can start it from the file browser/explorer
2022-10-04 11:07:09 +01:00
Divided by Zer0
9ec4b672a2
Fix infinite loop on bridge mode when seed == 0 (#1406)
The bridge will keep looping on the same generation because the
evaluation of "while not seed" will always be False when seed is 0 (or
00000000 etc)

This fixes this. Also allows to request more verbosity on the webui
command

Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>
Co-authored-by: lukas5450 <46075099+lukas5450@users.noreply.github.com>
2022-10-03 09:26:26 +01:00
xaedes
33b896d0cb
Scene-to-Image Prompt Layering System (#1179)
# Summary of the change

- new Scene-to-Image tab
- new scn2img function
- functions for loading and running monocular_depth_estimation with
tensorflow

# Description

(relevant motivation, which issue is fixed)

Related to discussion #925

> Would it be possible to have a layers system where we could do have
foreground, mid, and background objects which relate to one another and
share the style? So we could say generate a landscape, one another layer
generate a castle, and on another layer generate a crowd of people.

To make this work I made a prompt-based layering system in a new
"Scene-to-Image" tab.
You write a a multi-line prompt that looks like markdown, where each
section declares one layer.
It is hierarchical, so each layer can have their own child layers.

Examples: https://imgur.com/a/eUxd5qn
![](https://i.imgur.com/L61w00Q.png)

In the frontend you can find a brief documentation for the syntax,
examples and reference for the various arguments.

Here a short summary:

Sections with "prompt" and child layers are img2img, without child
layers they are txt2img.
Without "prompt" they are just images, useful for mask selection, image
composition, etc.
Images can be initialized with "color", resized with "resize" and their
position specified with "pos".
Rotation and rotation center are "rotation" and "center". 

Mask can automatically be selected by color or by estimated depth based
on https://huggingface.co/spaces/atsantiago/Monocular_Depth_Filter.

![](https://i.imgur.com/8rMHWmZ.png)

# Additional dependencies that are required for this change

For mask selection by monocular depth estimation tensorflow is required
and the model must be cloned to ./src/monocular_depth_estimation/
Changes in environment.yaml:
- einops>=0.3.0
- tensorflow>=2.10.0 

Einops must be allowed to be newer for tensorflow to work.

# Checklist:

- [x] I have changed the base branch to `dev`
- [x] I have performed a self-review of my own code
- [x] I have commented my code in hard-to-understand areas
- [x] I have made corresponding changes to the documentation

Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>
2022-10-02 18:23:37 +01:00
Divided by Zer0
5853f3e1a1
Stable Horde bridge (#1204)
# Adds the bridge code which when enabled turns the webui into a
headless [Stable Horde](https://stablehorde.net) instance

It adds a few new command-line args to be able to pass variables to the
bridge, as well as the possibility to set it via a variables files
`bridgeData.py`.

To start the bridge, one needs to add the `--bridge` argument to their
relauncher.py as well as any horde vars they want to specify.

On top of that this adds the loguru module as well as my tuned loguru
config. This provides a much nicer logging output and provides the
capability to save output to files for issue reports etc. For now only
the bridge is utilizing the nice format, but once it's merged, you can
start replacing `print()` with `logger.xxx()` where appropriate

To make the bridge work, I've had to add defaults to txt2img but this
should not affect anything.


# Checklist:

- [ x ] I have changed the base branch to `dev`
- [ x ] I have performed a self-review of my own code
- [ x ] I have commented my code in hard-to-understand areas
- [ x ] I have made corresponding changes to the documentation

Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>
Co-authored-by: Thomas Mello <work.mello@gmail.com>
Co-authored-by: Joshua Kimsey <jkimsey95@gmail.com>
Co-authored-by: ZeroCool <ZeroCool940711@users.noreply.github.com>
2022-10-02 18:22:27 +01:00
hlky
4a15702fe9
License header 2022-09-26 14:02:48 +01:00
xaedes
70acb61c21
remove wrong arguments from save_sample call (#1290)
fixes #1258
2022-09-24 01:29:12 +01:00
Colton
f0be43d7df
Send the image grid to the front end if generated for a prompt matrix (#1200) 2022-09-23 14:32:36 +03:00
Thomas Mello
148c41826b Merge branch 'dev' into the-merge
# Conflicts:
#	.gitignore
#	README.md
#	configs/webui/webui_streamlit.yaml
#	environment.yaml
#	frontend/css/streamlit.main.css
#	frontend/frontend.py
#	scripts/webui_streamlit.py
2022-09-18 12:31:17 +03:00
bryanlyon
b5462536f8
Fixed decimal prompt weights without leading digit (#1182)
The regex was not accounting properly for prompt weights that didn't begin with a leading number such as .5 or .1 and was instead splitting those off into their own prompt which got everything all screwed up.

For example, the prompt string of "Fruit:1 grapes:-.5" should parse as
[('Fruit', 1.0), ('grapes', -.5)]
but was being incorrectly parsed as
[('Fruit', 1.0), ('grapes', 1.0), ('-.5', 1.0)]

This fixes that by making the regex properly catch decimals.
2022-09-16 20:42:41 +01:00
xaedes
4efe62b31a
add missing argument to GoBig sample function, fixes #1183 (#1184) 2022-09-16 20:40:30 +01:00
cobryan05
81f58d58d0
Re-merge #611 - View/Cancel in-progress diffusions (#796)
* JobManager: Re-merge #611

PR #611 seems to have got lost in the shuffle after
the transition to 'dev'.

This commit re-merges the feature branch. This adds
support for viewing preview images as the image
generates, as well as cancelling in-progress images
and a couple fixes and clean-ups.

* JobManager: Clear jobs that fail to start

Sometimes if a job fails to start it will get stuck in the active job
list. This commit ensures that jobs that raise exceptions are cleared,
and also adds a start timer to clear out jobs that fail to start
within a reasonable amount of time.
2022-09-14 23:48:56 +03:00
Rae Fu
2124b7208f support negative prompts separated by ###
e.g. "shopping mall ### people" will try to generate an image of a mall
without people in it.
2022-09-11 14:51:20 -06:00
M
9f8a7a61ad
webui: add prompt output to console (#1031)
* webui: add prompt output to console

show the user what prompt is currently being rendered

* fix prompt print location
2022-09-11 22:21:38 +03:00
oc013
8a8b993fd5
Add missing comma for nsfw toggle in img2img (#1028) 2022-09-11 20:18:17 +03:00
M
a98753cf10
webui: display the GPU in use during startup (#994)
* webui: display the GPU in use during startup

tell the user which GPU the code is actually going to use before spending lots of time loading everything onto the GPU

* typo

* add some info messages

* evaluate current GPU properly

* add debug flag gating

not everyone wants or needs to see debug messages :)

* add in stray debug msg
2022-09-11 14:47:34 +03:00
Mr. Gecko
69d6e53474
Add NSFW filter to avoid unexpected (#955)
* Add NSFW filter to avoid unexpected

* Fix img2img configuration numbering
2022-09-11 12:32:36 +03:00
M
20adc46b75
webui: detect scoped-down GPU environment (#993)
* webui: detect scoped-down GPU environment

check if we're using a scoped-down GPU environment (pynvml does not listen to CUDA_VISIBLE_DEVICES) so that we can measure memory on the correct GPU

* remove unnecessary import
2022-09-11 04:41:29 +03:00
Thomas Mello
d6f4796c35
fix: sampler name in GoBig #988 2022-09-11 01:52:51 +03:00
node7-ai
2236e8b585
fix: sampler name in GoBig 2022-09-11 01:48:11 +03:00
xaedes
008af2d8ff
Perform masked image restoration for GFPGAN, RealESRGAN, fixing #947
* Perform masked image restoration when using GFPGAN or RealESRGAN, fixing #947.
Also fixes bug in image display when using masked image restoration with RealESRGAN.

When the image is upscaled using RealESRGAN the image restoration can not use the
original image because it has wrong resolution. In this case the image restoration
will restore the non-regenerated parts of the image with an RealESRGAN upscaled
version of the original input image.

Modifications from GFPGAN or color correction in (un)masked parts are also restored
to the original image by mask blending.

* Update scripts/webui.py

Co-authored-by: Thomas Mello <work.mello@gmail.com>
2022-09-10 18:37:42 +03:00
Soul-Burn
3e9cdb1dcb Better support for large batches in optimized mode 2022-09-10 15:25:13 +01:00
Thomas Mello
f8a6a4eba8
fix: lost imports from #921 2022-09-10 01:54:19 +03:00
Michael Hearn
002dca063d Image transparency is used as mask for inpainting 2022-09-09 18:28:40 -04:00
xaedes
07062941c7
add img2img option for color correction. (#936)
color correction is already used for loopback to prevent color drift with the first image as correction target.
the option allows to use the color correction even without loopback mode.
it helps keeping the colors similar to the input image.
2022-09-10 00:44:30 +03:00
xaedes
f6aa2c64eb
Add mask_restore to restore images based on mask, fixing #665 (#898)
* Add mask_restore option to give users the option to restore images based on mask, fixing #665.

Before commit c73fdd78  (Implement masking during sampling to improve blending, #308)
image mask was applied after sampling, resulting in masked parts that are not regenerated
to actually stay the same.
Since c73fdd78 the masked img2img will change the whole image, even in masked areas.
It gives better looking results at first glance, but will result in image degredation when
applied a few times. See issue #665.

In the workflow of using repeated masked img2img, users may want to use this options to keep the parts
of image they actually want to keep without image degradation. A final masked img2img or whole image img2img with mask_restore disabled
will give the better blending of "Implement masking during sampling".

* revert changes of a7be43ba in change_image_editor_mode

* fix ui_functions.change_image_editor_mode by adding gr.update to the end of the list it returns

* revert inserted newlines and whitespaces to match format of previous code

* improve caption of new option mask_restore

"Only modify regenerated parts of image"

* fix ui_functions.change_image_editor_mode by adding gr.update to the end of the list it returns

an old copy of the function exists in webui.py, this superflous function mistakenly was changed by the earlier commit b6a9e16b

* remove unused functions that are near duplicates of functions in ui_functions.py
2022-09-10 00:07:14 +03:00
Thomas Mello
16d2941619
fix: filename format parameter (#923) 2022-09-09 22:11:57 +03:00
VulumeCode
1422b35ac6
Tiling parameter (#911)
* tiling

* default to False
2022-09-09 20:33:04 +03:00
Michoko
4d76d6742c
Add filename formatting argument (#908)
* Update webui.py

Filename formatting argument

* Update scripts/webui.py

Co-authored-by: Thomas Mello <work.mello@gmail.com>
2022-09-09 20:20:59 +03:00
cobryan05
9d95449624
Metadata cleanup - Maintain metadata within UI (#845)
* Metadata cleanup - Maintain metadata within UI

This commit, when combined with Gradio 3.2.1b1+, maintains image
metadata as an image is passed throughout the UI. For example,
if you generate an image, send it to Image Lab, upscale it, fix faces,
and then drag the resulting image back in to Image Lab, it will still
remember the image generation parameters.

When the image is saved, the metadata will be stripped from it if
save-metadata is not enabled. If the image is saved by *dragging*
out of the UI on to the filesystem it may maintain its metadata.

Note: I have ran into UI responsiveness issues with upgrading Gradio.
Seems there may be some Gradio queue management issues. *Without* the
gradio update this commit will maintain current functionality, but
will not keep meetadata when dragging an image between UI components.

* Move ImageMetadata into its own file

Cleans up webui, enables webui_streamlit et al to use it as well.

* Fix typo
2022-09-09 19:27:21 +03:00
Logan zoellner
754e530d70 when in outcrop mode, mask added regions and fill in with voroni noise for better outpainting 2022-09-09 10:13:38 -04:00
hlky
490bbbc103
Img2img dev (#736)
* #715 #699 #698 #663 #625 #617 #611 #604 (#716)

* Update README.md

* Add sampler name to metadata (#695)

Co-authored-by: EliEron <example@example.com>

* old-dev-merge

Co-authored-by: EliEron <subanimehd@gmail.com>
Co-authored-by: EliEron <example@example.com>

* img2img-fix (#717)

* Revert "img2img-fix (#717)"

This reverts commit 70d4b1ca2a.

* img2img fixes

* Revert "img2img fixes"

This reverts commit e66eddc621.

* Revert "Revert "img2img-fix (#717)""

This reverts commit bf08b617d4.

* img2img fixed

* feat: bring back Crop mode, formatting

Co-authored-by: EliEron <subanimehd@gmail.com>
Co-authored-by: EliEron <example@example.com>
Co-authored-by: Thomas Mello <work.mello@gmail.com>
2022-09-07 20:19:00 +01:00
hlky
38737341da
Merge branch 'master' into dev 2022-09-07 03:09:33 +01:00
hlky
3b490df708
img2img fixed 2022-09-07 03:08:29 +01:00
hlky
cf754f9fe6
Revert "Revert "img2img-fix (#717)""
This reverts commit bf08b617d4.
2022-09-07 02:56:27 +01:00
hlky
06df5a5697
Revert "img2img fixes"
This reverts commit e66eddc621.
2022-09-07 02:56:23 +01:00
hlky
e66eddc621
img2img fixes 2022-09-07 02:35:01 +01:00
hlky
bf08b617d4
Revert "img2img-fix (#717)"
This reverts commit 70d4b1ca2a.
2022-09-07 01:45:15 +01:00
hlky
70d4b1ca2a
img2img-fix (#717) 2022-09-07 00:48:13 +01:00
hlky
f28255466b
#715 #699 #698 #663 #625 #617 #611 #604 (#716)
* Update README.md

* Add sampler name to metadata (#695)

Co-authored-by: EliEron <example@example.com>

* old-dev-merge

Co-authored-by: EliEron <subanimehd@gmail.com>
Co-authored-by: EliEron <example@example.com>
2022-09-07 00:43:51 +01:00
EliEron
d86e945ca2
Add sampler name to metadata (#695)
Co-authored-by: EliEron <example@example.com>
2022-09-07 00:33:47 +01:00
hlky
010b27ce9a
Repo merge (#712)
* repo-merge

* cutdown size

* Create setup.py

* webui.cmd

* ldm

* Update environment.yaml

* Update environment.yaml
2022-09-06 23:50:14 +01:00