Save space by removing model dependency

This commit is contained in:
ssit
2023-07-26 14:32:22 -04:00
parent d946d6c054
commit 2bc32f7b20
4 changed files with 5 additions and 9 deletions
+4 -1
View File
@@ -27,7 +27,10 @@ if not os.path.exists(model_path):
# Copy model to ./scripts/ using a hard link
dst = os.path.join(os.path.dirname(os.path.realpath(__file__)), "scripts", model_name)
os.link(model_path, dst)
if not os.path.exists(dst):
os.link(model_path, dst)
else:
print(f"Existing model found at {dst}, skipping hard link.")
print("Checking roop requirements")
with open(req_file) as file:
-1
View File
@@ -2,5 +2,4 @@ insightface==0.7.3
onnx==1.14.0
onnxruntime==1.15.0
opencv-python==4.7.0.72
ifnude
cython
+1 -6
View File
@@ -1,9 +1,4 @@
import tempfile
from ifnude import detect
def convert_to_sd(img):
shapes = []
chunks = detect(img)
for chunk in chunks:
shapes.append(chunk["score"] > 0.7)
return [any(shapes), tempfile.NamedTemporaryFile(delete=False, suffix=".png")]
return [False, tempfile.NamedTemporaryFile(delete=False, suffix=".png")]
-1
View File
@@ -17,7 +17,6 @@ from scripts.swapper import UpscaleOptions, swap_face, ImageResult
from scripts.roop_version import version_flag
import os
def get_models():
models_path = os.path.join(scripts.basedir(), "models" + os.path.sep + "roop" + os.path.sep + "*")
models = glob.glob(models_path)