Fixes
This commit is contained in:
parent
29b40758de
commit
bc72995074
88
README.md
88
README.md
@ -1,44 +1,44 @@
|
|||||||
# roop for StableDiffusion
|
# roop for StableDiffusion
|
||||||
### 'NSFW filter OFF' version (use it at your own responsibility)
|
### 'NSFW filter OFF' version (use it at your own responsibility)
|
||||||
|
|
||||||
This is an extension for StableDiffusion's [AUTOMATIC1111 web-ui](https://github.com/AUTOMATIC1111/stable-diffusion-webui/) that allows face-replacement in images. It is based on [roop](https://github.com/s0md3v/roop) but will be developed seperately.
|
This is an extension for StableDiffusion's [AUTOMATIC1111 web-ui](https://github.com/AUTOMATIC1111/stable-diffusion-webui/) that allows face-replacement in images. It is based on [roop](https://github.com/s0md3v/roop) but will be developed seperately.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Disclaimer
|
### Disclaimer
|
||||||
|
|
||||||
This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc.
|
This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc.
|
||||||
|
|
||||||
The developers of this software are aware of its possible unethical applicaitons and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law.
|
The developers of this software are aware of its possible unethical applicaitons and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law.
|
||||||
|
|
||||||
Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users.
|
Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
To install the extension, follow these steps:
|
To install the extension, follow these steps:
|
||||||
|
|
||||||
+ In web-ui, go to the "Extensions" tab and use this URL `https://github.com/s0md3v/sd-webui-roop` in the "install from URL" tab.
|
+ In web-ui, go to the "Extensions" tab and use this URL `https://github.com/s0md3v/sd-webui-roop` in the "install from URL" tab.
|
||||||
+ Download the "inswapper_128.onnx" model from [here](https://huggingface.co/henryruhs/roop/resolve/main/inswapper_128.onnx) and put it inside `<web-ui-dir>/extensions/roop/models` directory.
|
+ Restart the UI
|
||||||
|
|
||||||
On Windows, Microsoft Visual C++ 14.0 or greater must be installed before installing the extension. [During the install, make sure to include the Python and C++ packages.](https://github.com/s0md3v/roop/issues/153)
|
On Windows, Microsoft Visual C++ 14.0 or greater must be installed before installing the extension. [During the install, make sure to include the Python and C++ packages.](https://github.com/s0md3v/roop/issues/153)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Under "roop" drop-down menu, import an image containing a face.
|
1. Under "roop" drop-down menu, import an image containing a face.
|
||||||
2. Turn on the "Enable" checkbox
|
2. Turn on the "Enable" checkbox
|
||||||
3. That's it, now the generated result will have the face you selected
|
3. That's it, now the generated result will have the face you selected
|
||||||
|
|
||||||
### The result face is blurry
|
### The result face is blurry
|
||||||
Use the "Restore Face" option. You can also try the "Upscaler" option or for more finer control, use an upscaler from the "Extras" tab.
|
Use the "Restore Face" option. You can also try the "Upscaler" option or for more finer control, use an upscaler from the "Extras" tab.
|
||||||
|
|
||||||
### There are multiple faces in result
|
### There are multiple faces in result
|
||||||
Select the face numbers you wish to swap using the "Comma separated face number(s)" option.
|
Select the face numbers you wish to swap using the "Comma separated face number(s)" option.
|
||||||
|
|
||||||
### ~~The result is totally black~~
|
### ~~The result is totally black~~
|
||||||
~~This means roop detected that your image is NSFW.~~
|
~~This means roop detected that your image is NSFW.~~
|
||||||
|
|
||||||
### Img2Img
|
### Img2Img
|
||||||
|
|
||||||
You can choose to activate the swap on the source image or on the generated image, or on both using the checkboxes. Activating on source image allows you to start from a given base and apply the diffusion process to it.
|
You can choose to activate the swap on the source image or on the generated image, or on both using the checkboxes. Activating on source image allows you to start from a given base and apply the diffusion process to it.
|
||||||
|
|
||||||
Inpainting should work but only the masked part will be swapped.
|
Inpainting should work but only the masked part will be swapped.
|
||||||
|
|||||||
100
install.py
100
install.py
@ -1,44 +1,56 @@
|
|||||||
import launch
|
import launch
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
from tqdm import tqdm
|
||||||
|
import urllib.request
|
||||||
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
|
|
||||||
|
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
|
||||||
import os
|
|
||||||
|
import os
|
||||||
models_dir = os.path.abspath("models/roop")
|
|
||||||
|
models_dir = os.path.abspath("models/roop")
|
||||||
if not os.path.exists(models_dir):
|
|
||||||
os.makedirs(models_dir)
|
model_url = "https://huggingface.co/henryruhs/roop/resolve/main/inswapper_128.onnx"
|
||||||
print(f"roop : You can put the model in {models_dir} directory")
|
model_name = os.path.basename(model_url)
|
||||||
|
model_path = os.path.join(models_dir, model_name)
|
||||||
print("Check roop requirements")
|
|
||||||
with open(req_file) as file:
|
def download(url, path):
|
||||||
for package in file:
|
request = urllib.request.urlopen(url)
|
||||||
try:
|
total = int(request.headers.get('Content-Length', 0))
|
||||||
python = sys.executable
|
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
|
||||||
package = package.strip()
|
urllib.request.urlretrieve(url, path, reporthook=lambda count, block_size, total_size: progress.update(block_size))
|
||||||
|
|
||||||
if not launch.is_installed(package):
|
if not os.path.exists(models_dir):
|
||||||
print(f"Install {package}")
|
os.makedirs(models_dir)
|
||||||
launch.run_pip(
|
|
||||||
f"install {package}", f"sd-webui-roop requirement: {package}"
|
if not os.path.exists(model_path):
|
||||||
)
|
download(model_url, model_path)
|
||||||
elif "==" in package:
|
|
||||||
package_name, package_version = package.split("==")
|
print("Checking nsfw-roop requirements...")
|
||||||
installed_version = pkg_resources.get_distribution(package_name).version
|
|
||||||
if installed_version != package_version:
|
with open(req_file) as file:
|
||||||
print(
|
for package in file:
|
||||||
f"Install {package}, {installed_version} vs {package_version}"
|
try:
|
||||||
)
|
package = package.strip()
|
||||||
launch.run_pip(
|
|
||||||
f"install {package}",
|
if "==" in package:
|
||||||
f"sd-webui-roop requirement: changing {package_name} version from {installed_version} to {package_version}",
|
package_name, package_version = package.split('==')
|
||||||
)
|
installed_version = pkg_resources.get_distribution(package_name).version
|
||||||
|
if installed_version != package_version:
|
||||||
except Exception as e:
|
print(
|
||||||
print(e)
|
f"Running install of {package}, {installed_version} vs {package_version}"
|
||||||
print(f"Warning: Failed to install {package}, roop will not work.")
|
)
|
||||||
raise e
|
launch.run_pip(
|
||||||
|
f"install {package}",
|
||||||
|
f"sd-webui-roop-nsfw requirement: changing {package_name} version from {installed_version} to {package_version}"
|
||||||
|
)
|
||||||
|
elif not launch.is_installed(package):
|
||||||
|
launch.run_pip(f"install {package}", f"sd-webui-roop-nsfw requirement: {package}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
print(f"Warning: Failed to install {package}, nsfw-roop will not work.")
|
||||||
|
raise e
|
||||||
|
finally:
|
||||||
|
print(f'{package} - ok')
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
insightface==0.7.3
|
insightface==0.7.3
|
||||||
onnx==1.14.0
|
onnx==1.14.0
|
||||||
onnxruntime==1.15.0
|
onnxruntime==1.15.0
|
||||||
tensorflow==2.12.0
|
tensorflow==2.12.0
|
||||||
opencv-python==4.7.0.72
|
opencv-python==4.7.0.72
|
||||||
diffusers==0.17.1
|
diffusers==0.17.1
|
||||||
|
tqdm
|
||||||
Loading…
x
Reference in New Issue
Block a user