Update updater_facefusion.py
Browse files- updater_facefusion.py +4 -34
updater_facefusion.py
CHANGED
|
@@ -54,38 +54,7 @@ abs_path = get_install_path()
|
|
| 54 |
git = os.path.join(abs_path, "system", "git", "cmd", "git.exe")
|
| 55 |
ff_obs = os.path.join(abs_path, "sources", "facefusion")
|
| 56 |
master_path = os.path.join(ff_obs, "master")
|
| 57 |
-
python = os.path.join(abs_path, "
|
| 58 |
-
master = os.path.join(ff_obs, "master", "facefusion", "content_analyser.py")
|
| 59 |
-
venv_path = venv_path = os.path.join(ff_obs, "venv")
|
| 60 |
-
activate_script = os.path.join(venv_path, "Scripts", "activate.bat")
|
| 61 |
-
|
| 62 |
-
def get_uv_path():
|
| 63 |
-
if sys.platform.startswith('win'):
|
| 64 |
-
scripts_dir = os.path.join(os.path.dirname(python), 'Scripts')
|
| 65 |
-
uv_executable = os.path.join(scripts_dir, "uv.exe")
|
| 66 |
-
else:
|
| 67 |
-
scripts_dir = os.path.join(os.path.dirname(os.path.dirname(python)), 'bin')
|
| 68 |
-
uv_executable = os.path.join(scripts_dir, "uv")
|
| 69 |
-
return uv_executable
|
| 70 |
-
|
| 71 |
-
uv_executable = get_uv_path()
|
| 72 |
-
|
| 73 |
-
def process_file_master(master):
|
| 74 |
-
with open(master, 'r') as f:
|
| 75 |
-
lines = f.readlines()
|
| 76 |
-
with open(master, 'w') as f:
|
| 77 |
-
inside_function = False
|
| 78 |
-
for line in lines:
|
| 79 |
-
if 'def analyse_frame(' in line:
|
| 80 |
-
inside_function = True
|
| 81 |
-
f.write(line)
|
| 82 |
-
f.write(' return False\n')
|
| 83 |
-
elif inside_function:
|
| 84 |
-
if line.startswith('def ') or line.strip() == '':
|
| 85 |
-
inside_function = False
|
| 86 |
-
f.write(line)
|
| 87 |
-
else:
|
| 88 |
-
f.write(line)
|
| 89 |
|
| 90 |
def run_git_command(args):
|
| 91 |
subprocess.run([git] + args, check=True)
|
|
@@ -105,9 +74,11 @@ def start_ff(branch, webcam_mode=False):
|
|
| 105 |
else:
|
| 106 |
args = ["run"]
|
| 107 |
|
| 108 |
-
cmd = f'"{
|
|
|
|
| 109 |
subprocess.run(cmd, shell=True, check=True)
|
| 110 |
|
|
|
|
| 111 |
def get_localized_text(language, key):
|
| 112 |
texts = {
|
| 113 |
"en": {
|
|
@@ -155,7 +126,6 @@ def facefusion():
|
|
| 155 |
|
| 156 |
if choice == '1':
|
| 157 |
update_branch('master')
|
| 158 |
-
process_file_master(master)
|
| 159 |
webcam_mode = ask_webcam_mode(language)
|
| 160 |
start_ff("master", webcam_mode)
|
| 161 |
else:
|
|
|
|
| 54 |
git = os.path.join(abs_path, "system", "git", "cmd", "git.exe")
|
| 55 |
ff_obs = os.path.join(abs_path, "sources", "facefusion")
|
| 56 |
master_path = os.path.join(ff_obs, "master")
|
| 57 |
+
python = os.path.join(abs_path, "sources", "facefusion", "venv", "Scripts", "python.exe")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
def run_git_command(args):
|
| 60 |
subprocess.run([git] + args, check=True)
|
|
|
|
| 74 |
else:
|
| 75 |
args = ["run"]
|
| 76 |
|
| 77 |
+
cmd = f'"{python}" "{second_file}" {" ".join(args)}'
|
| 78 |
+
|
| 79 |
subprocess.run(cmd, shell=True, check=True)
|
| 80 |
|
| 81 |
+
|
| 82 |
def get_localized_text(language, key):
|
| 83 |
texts = {
|
| 84 |
"en": {
|
|
|
|
| 126 |
|
| 127 |
if choice == '1':
|
| 128 |
update_branch('master')
|
|
|
|
| 129 |
webcam_mode = ask_webcam_mode(language)
|
| 130 |
start_ff("master", webcam_mode)
|
| 131 |
else:
|