Fixes
This commit is contained in:
parent
29b40758de
commit
bc72995074
88
README.md
88
README.md
@ -1,44 +1,44 @@
|
||||
# roop for StableDiffusion
|
||||
### '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.
|
||||
|
||||

|
||||
|
||||
### 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.
|
||||
|
||||
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.
|
||||
|
||||
## Installation
|
||||
|
||||
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.
|
||||
+ 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.
|
||||
|
||||
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
|
||||
|
||||
1. Under "roop" drop-down menu, import an image containing a face.
|
||||
2. Turn on the "Enable" checkbox
|
||||
3. That's it, now the generated result will have the face you selected
|
||||
|
||||
### 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.
|
||||
|
||||
### There are multiple faces in result
|
||||
Select the face numbers you wish to swap using the "Comma separated face number(s)" option.
|
||||
|
||||
### ~~The result is totally black~~
|
||||
~~This means roop detected that your image is NSFW.~~
|
||||
|
||||
### 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.
|
||||
|
||||
Inpainting should work but only the masked part will be swapped.
|
||||
# roop for StableDiffusion
|
||||
### '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.
|
||||
|
||||

|
||||
|
||||
### 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.
|
||||
|
||||
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.
|
||||
|
||||
## Installation
|
||||
|
||||
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.
|
||||
+ 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)
|
||||
|
||||
## Usage
|
||||
|
||||
1. Under "roop" drop-down menu, import an image containing a face.
|
||||
2. Turn on the "Enable" checkbox
|
||||
3. That's it, now the generated result will have the face you selected
|
||||
|
||||
### 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.
|
||||
|
||||
### There are multiple faces in result
|
||||
Select the face numbers you wish to swap using the "Comma separated face number(s)" option.
|
||||
|
||||
### ~~The result is totally black~~
|
||||
~~This means roop detected that your image is NSFW.~~
|
||||
|
||||
### 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.
|
||||
|
||||
Inpainting should work but only the masked part will be swapped.
|
||||
|
||||
100
install.py
100
install.py
@ -1,44 +1,56 @@
|
||||
import launch
|
||||
import os
|
||||
import pkg_resources
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
|
||||
|
||||
import os
|
||||
|
||||
models_dir = os.path.abspath("models/roop")
|
||||
|
||||
if not os.path.exists(models_dir):
|
||||
os.makedirs(models_dir)
|
||||
print(f"roop : You can put the model in {models_dir} directory")
|
||||
|
||||
print("Check roop requirements")
|
||||
with open(req_file) as file:
|
||||
for package in file:
|
||||
try:
|
||||
python = sys.executable
|
||||
package = package.strip()
|
||||
|
||||
if not launch.is_installed(package):
|
||||
print(f"Install {package}")
|
||||
launch.run_pip(
|
||||
f"install {package}", f"sd-webui-roop requirement: {package}"
|
||||
)
|
||||
elif "==" in package:
|
||||
package_name, package_version = package.split("==")
|
||||
installed_version = pkg_resources.get_distribution(package_name).version
|
||||
if installed_version != package_version:
|
||||
print(
|
||||
f"Install {package}, {installed_version} vs {package_version}"
|
||||
)
|
||||
launch.run_pip(
|
||||
f"install {package}",
|
||||
f"sd-webui-roop requirement: changing {package_name} version from {installed_version} to {package_version}",
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(f"Warning: Failed to install {package}, roop will not work.")
|
||||
raise e
|
||||
import launch
|
||||
import os
|
||||
import pkg_resources
|
||||
import sys
|
||||
from tqdm import tqdm
|
||||
import urllib.request
|
||||
|
||||
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
|
||||
|
||||
import os
|
||||
|
||||
models_dir = os.path.abspath("models/roop")
|
||||
|
||||
model_url = "https://huggingface.co/henryruhs/roop/resolve/main/inswapper_128.onnx"
|
||||
model_name = os.path.basename(model_url)
|
||||
model_path = os.path.join(models_dir, model_name)
|
||||
|
||||
def download(url, path):
|
||||
request = urllib.request.urlopen(url)
|
||||
total = int(request.headers.get('Content-Length', 0))
|
||||
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
|
||||
urllib.request.urlretrieve(url, path, reporthook=lambda count, block_size, total_size: progress.update(block_size))
|
||||
|
||||
if not os.path.exists(models_dir):
|
||||
os.makedirs(models_dir)
|
||||
|
||||
if not os.path.exists(model_path):
|
||||
download(model_url, model_path)
|
||||
|
||||
print("Checking nsfw-roop requirements...")
|
||||
|
||||
with open(req_file) as file:
|
||||
for package in file:
|
||||
try:
|
||||
package = package.strip()
|
||||
|
||||
if "==" in package:
|
||||
package_name, package_version = package.split('==')
|
||||
installed_version = pkg_resources.get_distribution(package_name).version
|
||||
if installed_version != package_version:
|
||||
print(
|
||||
f"Running install of {package}, {installed_version} vs {package_version}"
|
||||
)
|
||||
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
|
||||
onnx==1.14.0
|
||||
onnxruntime==1.15.0
|
||||
tensorflow==2.12.0
|
||||
opencv-python==4.7.0.72
|
||||
diffusers==0.17.1
|
||||
insightface==0.7.3
|
||||
onnx==1.14.0
|
||||
onnxruntime==1.15.0
|
||||
tensorflow==2.12.0
|
||||
opencv-python==4.7.0.72
|
||||
diffusers==0.17.1
|
||||
tqdm
|
||||
Loading…
x
Reference in New Issue
Block a user