UPDATE: models paths, old path check
- "models/roop" folder renamed to "models/insightface"; - buffalo models go to "models/insightface" (no need to keep them in the user's profile directory); thanks @h3rmit-git for the idea - VersionUP (beta passed)
This commit is contained in:
parent
0a6fe997ac
commit
e4eecb942e
16
README.md
16
README.md
@ -1,18 +1,20 @@
|
||||
<div align="center">
|
||||
|
||||
<img src="example/ReActor_logo_red.png" alt="logo" width="180px"/>
|
||||
<img src="example/ReActor_logo_red.png" alt="logo" width="180px" style="margin-bottom:-33px"/>
|
||||
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/commits/main)
|
||||

|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues)
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues?q=is%3Aissue+is%3Aclosed)
|
||||

|
||||
# 
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/commits/main)
|
||||

|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0)
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues?q=is%3Aissue+is%3Aclosed)
|
||||

|
||||
|
||||
English | [Русский](/README_RU.md)
|
||||
|
||||
# ReActor for StableDiffusion
|
||||
|
||||
</div>
|
||||
|
||||
# <div align="center">ReActor 0.4.0b for StableDiffusion</div>
|
||||
### The Fast and Simple "[roop-based](https://github.com/s0md3v/sd-webui-roop)" FaceSwap Extension with a lot of improvements and without NSFW filter (uncensored, use it on your own [responsibility](#disclaimer))
|
||||
|
||||
> Ex "Roop-GE" (GE - Gourieff Edition, aka "NSFW-Roop"), the extension was renamed with the version 0.3.0<br>
|
||||
|
||||
17
README_RU.md
17
README_RU.md
@ -1,16 +1,17 @@
|
||||
<div align="center">
|
||||
|
||||
<img src="example/ReActor_logo_red.png" alt="logo" width="180px"/>
|
||||
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/commits/main)
|
||||

|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues)
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues?q=is%3Aissue+is%3Aclosed)
|
||||

|
||||
<img src="example/ReActor_logo_red.png" alt="logo" width="180px" style="margin-bottom:-33px"/>
|
||||
|
||||
# 
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/commits/main)
|
||||

|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues?cacheSeconds=0)
|
||||
[](https://github.com/Gourieff/sd-webui-reactor/issues?q=is%3Aissue+is%3Aclosed)
|
||||

|
||||
|
||||
[English](/README.md) | Русский
|
||||
|
||||
# ReActor 0.4.0b для StableDiffusion
|
||||
# ReActor для StableDiffusion
|
||||
### Расширение для быстрой и простой замены лиц на любых изображениях. Без фильтра цензуры, 18+, используйте под вашу собственную [ответственность](#disclaimer)
|
||||
|
||||
</div>
|
||||
|
||||
@ -5,10 +5,14 @@ from tqdm import tqdm
|
||||
import urllib.request
|
||||
from packaging import version as pv
|
||||
|
||||
from modules.paths_internal import models_path
|
||||
|
||||
req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
|
||||
|
||||
models_dir = os.path.abspath("models/roop")
|
||||
|
||||
models_dir_old = os.path.join(models_path, "roop")
|
||||
models_dir = os.path.join(models_path, "insightface")
|
||||
if os.path.exists(models_dir_old):
|
||||
os.rename(models_dir_old, models_dir)
|
||||
model_url = "https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx"
|
||||
model_name = os.path.basename(model_url)
|
||||
model_path = os.path.join(models_dir, model_name)
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
import os, glob
|
||||
import gradio as gr
|
||||
from PIL import Image
|
||||
|
||||
import modules.scripts as scripts
|
||||
from modules.upscaler import Upscaler, UpscalerData
|
||||
from modules import scripts, shared, images, scripts_postprocessing
|
||||
@ -6,22 +9,21 @@ from modules.processing import (
|
||||
StableDiffusionProcessing,
|
||||
StableDiffusionProcessingImg2Img,
|
||||
)
|
||||
from PIL import Image
|
||||
import glob
|
||||
from modules.face_restoration import FaceRestoration
|
||||
from modules.paths_internal import models_path
|
||||
|
||||
from scripts.logger import logger
|
||||
from scripts.swapper import UpscaleOptions, swap_face, check_process_halt, reset_messaged
|
||||
from scripts.version import version_flag, app_title
|
||||
from scripts.console_log_patch import apply_logging_patch
|
||||
import os
|
||||
|
||||
|
||||
MODELS_PATH = None
|
||||
|
||||
def get_models():
|
||||
global MODELS_PATH
|
||||
models_path = os.path.join(scripts.basedir(), "models/roop/*")
|
||||
models = glob.glob(models_path)
|
||||
models_path_init = os.path.join(models_path, "insightface/*")
|
||||
models = glob.glob(models_path_init)
|
||||
models = [x for x in models if x.endswith(".onnx") or x.endswith(".pth")]
|
||||
models_names = []
|
||||
for model in models:
|
||||
|
||||
@ -13,6 +13,7 @@ import onnxruntime
|
||||
from modules.face_restoration import FaceRestoration
|
||||
from modules.upscaler import UpscalerData
|
||||
from modules.shared import state
|
||||
from modules.paths_internal import models_path
|
||||
from scripts.logger import logger
|
||||
|
||||
import warnings
|
||||
@ -86,7 +87,7 @@ def getAnalysisModel():
|
||||
global ANALYSIS_MODEL
|
||||
if ANALYSIS_MODEL is None:
|
||||
ANALYSIS_MODEL = insightface.app.FaceAnalysis(
|
||||
name="buffalo_l", providers=providers # note: allowed_modules=['detection', 'genderage']
|
||||
name="buffalo_l", providers=providers, root=os.path.join(models_path, "insightface") # note: allowed_modules=['detection', 'genderage']
|
||||
)
|
||||
return ANALYSIS_MODEL
|
||||
|
||||
@ -193,6 +194,10 @@ def get_face_single(img_data: np.ndarray, face_index=0, det_size=(640, 640), gen
|
||||
face_analyser.prepare(ctx_id=0, det_size=det_size)
|
||||
face = face_analyser.get(img_data)
|
||||
|
||||
buffalo_path = os.path.join(models_path, "insightface/models/buffalo_l.zip")
|
||||
if os.path.exists(buffalo_path):
|
||||
os.remove(buffalo_path)
|
||||
|
||||
if gender_source != 0:
|
||||
if len(face) == 0 and det_size[0] > 320 and det_size[1] > 320:
|
||||
return reget_face_single(img_data, det_size, face_index)
|
||||
@ -252,7 +257,7 @@ def swap_face(
|
||||
elif source_face is not None:
|
||||
|
||||
result = target_img
|
||||
model_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), model)
|
||||
model_path = os.path.join(models_path, "insightface", model)
|
||||
face_swapper = getFaceSwapModel(model_path)
|
||||
|
||||
source_face_idx = 0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
app_title = "ReActor"
|
||||
version_flag = "v0.4.0b"
|
||||
version_flag = "v0.4.0"
|
||||
|
||||
from scripts.logger import logger, get_Run, set_Run
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user