Fixes
This commit is contained in:
parent
29b40758de
commit
bc72995074
@ -18,7 +18,7 @@ Users of this software are expected to use this software responsibly while abidi
|
|||||||
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)
|
||||||
|
|
||||||
|
|||||||
40
install.py
40
install.py
@ -2,7 +2,8 @@ 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")
|
||||||
|
|
||||||
@ -10,35 +11,46 @@ import os
|
|||||||
|
|
||||||
models_dir = os.path.abspath("models/roop")
|
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):
|
if not os.path.exists(models_dir):
|
||||||
os.makedirs(models_dir)
|
os.makedirs(models_dir)
|
||||||
print(f"roop : You can put the model in {models_dir} directory")
|
|
||||||
|
|
||||||
print("Check roop requirements")
|
if not os.path.exists(model_path):
|
||||||
|
download(model_url, model_path)
|
||||||
|
|
||||||
|
print("Checking nsfw-roop requirements...")
|
||||||
|
|
||||||
with open(req_file) as file:
|
with open(req_file) as file:
|
||||||
for package in file:
|
for package in file:
|
||||||
try:
|
try:
|
||||||
python = sys.executable
|
|
||||||
package = package.strip()
|
package = package.strip()
|
||||||
|
|
||||||
if not launch.is_installed(package):
|
if "==" in package:
|
||||||
print(f"Install {package}")
|
package_name, package_version = package.split('==')
|
||||||
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
|
installed_version = pkg_resources.get_distribution(package_name).version
|
||||||
if installed_version != package_version:
|
if installed_version != package_version:
|
||||||
print(
|
print(
|
||||||
f"Install {package}, {installed_version} vs {package_version}"
|
f"Running install of {package}, {installed_version} vs {package_version}"
|
||||||
)
|
)
|
||||||
launch.run_pip(
|
launch.run_pip(
|
||||||
f"install {package}",
|
f"install {package}",
|
||||||
f"sd-webui-roop requirement: changing {package_name} version from {installed_version} to {package_version}",
|
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:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print(f"Warning: Failed to install {package}, roop will not work.")
|
print(f"Warning: Failed to install {package}, nsfw-roop will not work.")
|
||||||
raise e
|
raise e
|
||||||
|
finally:
|
||||||
|
print(f'{package} - ok')
|
||||||
|
|||||||
@ -4,3 +4,4 @@ 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