Fixes for `pip` support
parent
43c33c2324
commit
dfbe8f0d45
|
|
@ -10,7 +10,7 @@ if os.path.isfile(f"{this_path}/lib_unprompted/config_user.json"):
|
|||
print("Unprompted - Skipping install.py check per `skip_requirements` flag")
|
||||
quit()
|
||||
else:
|
||||
print("Unprompted - You can skip the intall check to improve startup times by setting `skip_requirements` to true in config_user.json")
|
||||
print("Unprompted - You can skip the intall check to improve startup times by setting `skip_requirements` to true in lib_unprompted/config_user.json")
|
||||
debug = "debug_requirements" in cfg_dict and cfg_dict["debug_requirements"]
|
||||
|
||||
import launch, shutil, pkg_resources
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import json
|
||||
from types import SimpleNamespace
|
||||
import lib_unprompted.shortcodes as shortcodes
|
||||
from lib_unprompted.simpleeval import simple_eval
|
||||
from . import shortcodes
|
||||
from .simpleeval import simple_eval
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
import time
|
||||
import logging
|
||||
from lib_unprompted import helpers
|
||||
from . import helpers
|
||||
|
||||
VERSION = "11.0.3"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import gradio as gr
|
||||
try:
|
||||
import gradio as gr
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
class Shortcode():
|
||||
|
|
@ -156,8 +159,9 @@ class Shortcode():
|
|||
self.Unprompted.shortcode_user_vars["init_images"] = self.Unprompted.after_processed.images
|
||||
return ""
|
||||
|
||||
def img2img_patched(self, id_task: str, request: gr.Request, mode: int, prompt: str, negative_prompt: str, prompt_styles, init_img, sketch, init_img_with_mask, inpaint_color_sketch, inpaint_color_sketch_orig, init_img_inpaint, init_mask_inpaint, mask_blur: int, mask_alpha: float, inpainting_fill: int, n_iter: int, batch_size: int, cfg_scale: float, image_cfg_scale: float, denoising_strength: float, selected_scale_tab: int, height: int, width: int, scale_by: float, resize_mode: int, inpaint_full_res: bool, inpaint_full_res_padding: int, inpainting_mask_invert: int, img2img_batch_input_dir: str, img2img_batch_output_dir: str, img2img_batch_inpaint_mask_dir: str, override_settings_texts, img2img_batch_use_png_info: bool, img2img_batch_png_info_props: list, img2img_batch_png_info_dir: str, *args):
|
||||
|
||||
def img2img_patched(self, id_task: str, request: None, mode: int, prompt: str, negative_prompt: str, prompt_styles, init_img, sketch, init_img_with_mask, inpaint_color_sketch, inpaint_color_sketch_orig, init_img_inpaint, init_mask_inpaint, mask_blur: int, mask_alpha: float, inpainting_fill: int, n_iter: int, batch_size: int, cfg_scale: float, image_cfg_scale: float, denoising_strength: float, selected_scale_tab: int, height: int, width: int, scale_by: float, resize_mode: int, inpaint_full_res: bool, inpaint_full_res_padding: int, inpainting_mask_invert: int, img2img_batch_input_dir: str, img2img_batch_output_dir: str, img2img_batch_inpaint_mask_dir: str, override_settings_texts, img2img_batch_use_png_info: bool, img2img_batch_png_info_props: list, img2img_batch_png_info_dir: str, *args):
|
||||
if not request:
|
||||
request = gr.Request()
|
||||
import numpy as np
|
||||
from PIL import Image, ImageFilter, ImageEnhance, UnidentifiedImageError
|
||||
import gradio as gr
|
||||
|
|
|
|||
|
|
@ -12,9 +12,12 @@ class Shortcode():
|
|||
new_seed = self.Unprompted.main_p.seed
|
||||
|
||||
if new_seed == -1:
|
||||
from modules.processing import fix_seed
|
||||
fix_seed(self.Unprompted.main_p)
|
||||
new_seed = self.Unprompted.main_p.seed
|
||||
try:
|
||||
from modules.processing import fix_seed
|
||||
fix_seed(self.Unprompted.main_p)
|
||||
new_seed = self.Unprompted.main_p.seed
|
||||
except:
|
||||
new_seed = random.randint(0, 2**32 - 1)
|
||||
|
||||
random.seed(new_seed)
|
||||
self.Unprompted.shortcode_user_vars["seed"] = new_seed
|
||||
|
|
|
|||
|
|
@ -9,15 +9,10 @@ To achieve compatibility between Unprompted and ControlNet, you must manually re
|
|||
Bodysnatcher's default settings are designed to work well for most users. However, here are some general tips to help you get the best results:
|
||||
|
||||
- **Always use this template on the img2img inpaint tab.** If you want to perform inference on the entire image (rather than a masked subject), set `mask_method` to `none` but still use the inpaint tab.
|
||||
|
||||
- **Inpainting masks are generated automatically from the `class`.** If the original image contains multiple subjects of the same class, you can manually paint out the areas you *don't* want to process. By default, your manual mask is subtracted from the automatic mask.
|
||||
|
||||
- **Masked content mode:** For standard models, set this to `Original`. For inpainting models, set this to `Fill`.
|
||||
|
||||
- For inpainting models, I recommend choosing a high value for `Inpainting conditioning mask strength` in the WebUI settings (e.g. between 0.8 and 1). Lower values will result in more of the original image being retained, at the cost of the new subject's likeness. I have found it is better to retain qualities of the original image via ControlNet models.
|
||||
|
||||
- **You must download ControlNet models separately before using the ControlNet presets.** Check the `unprompted/templates/common/presets/controlnet` folder for more information on model names. In most cases, you can simply Google the model name to find a working download link.
|
||||
|
||||
- **ControlNet presets are NOT cross-compatible between SD 1.5 and SDXL!** At the time of writing, most of the presets are for SD 1.5. SDXL does not have many great ControlNet models yet. The best I've found for use with this template are `controlnetxlCNXL_ecomxlSoftedge` and `controlnetxlCNXL_xinsirCannyv2`.
|
||||
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@ from lib_unprompted.shared import Unprompted
|
|||
# Main object
|
||||
Unprompted = Unprompted()
|
||||
|
||||
# Note! If Unprompted is located elsewhere (e.g. as a package), you can try importing it like this instead:
|
||||
|
||||
# import inspect, os, sys
|
||||
# import unprompted.lib_unprompted.shared
|
||||
# module_path = os.path.dirname(os.path.dirname(inspect.getfile(unprompted.lib_unprompted.shared.Unprompted)))
|
||||
# sys.path.insert(0, f"{module_path}")
|
||||
# Unprompted = unprompted.lib_unprompted.shared.Unprompted(module_path)
|
||||
|
||||
|
||||
def do_unprompted(string):
|
||||
# Reset vars
|
||||
|
|
@ -24,4 +32,4 @@ while True:
|
|||
command = input("(INPUT) Unprompted string:")
|
||||
do_unprompted(command)
|
||||
except Exception as e:
|
||||
Unprompted.log.exception("Exception occurred.")
|
||||
Unprompted.log.exception("Exception occurred.")
|
||||
|
|
|
|||
Loading…
Reference in New Issue