Deepfuze updated

This commit is contained in:
Sam Khoze
2024-06-16 22:41:20 +05:30
committed by GitHub
parent 30d1f65d37
commit 824a56abc4
+32 -33
View File
@@ -1,4 +1,3 @@
import os import os
import sys import sys
import json import json
@@ -954,10 +953,10 @@ class DeepFuzeFaceSwap:
if device=="gpu": if device=="gpu":
command.extend(['--execution-providers',"coreml"]) command.extend(['--execution-providers',"coreml"])
print(command) print(command)
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
# audio_file = os.path.join(audio_dir,str(time.time()).replace(".","")+".wav") # audio_file = os.path.join(audio_dir,str(time.time()).replace(".","")+".wav")
# subprocess.run(["ffmpeg","-i",faceswap_filename, audio_file, '-y']) # subprocess.run(["ffmpeg","-i",faceswap_filename, audio_file, '-y'])
# ffmpeg -i sample.avi -q:a 0 -map a sample.mp3 # ffmpeg -i sample.avi -q:a 0 -map a sample.mp3
@@ -979,10 +978,10 @@ class DeepFuzeFaceSwap:
if device=="gpu": if device=="gpu":
command.extend(['--execution-providers',"coreml"]) command.extend(['--execution-providers',"coreml"])
print(command) print(command)
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
if frame_enhancer!="None": if frame_enhancer!="None":
command = [ command = [
@@ -1001,10 +1000,10 @@ class DeepFuzeFaceSwap:
print(command) print(command)
if device=="gpu": if device=="gpu":
command.extend(['--execution-providers',"coreml"]) command.extend(['--execution-providers',"coreml"])
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
# temp_file = "/".join(faceswap_filename.split("/")[:-1]) + "_"+faceswap_filename.split("/")[-1] # temp_file = "/".join(faceswap_filename.split("/")[:-1]) + "_"+faceswap_filename.split("/")[-1]
# subprocess.run(["ffmpeg","-i",faceswap_filename,"-i",audio_file,"-c","copy","-map","0:v:0","-map","1:a:0",temp_file,'-y']) # subprocess.run(["ffmpeg","-i",faceswap_filename,"-i",audio_file,"-c","copy","-map","0:v:0","-map","1:a:0",temp_file,'-y'])
# faceswap_filename = temp_file # faceswap_filename = temp_file
@@ -1354,10 +1353,10 @@ class DeepFuzeAdavance:
if device=="gpu": if device=="gpu":
command.extend(['--execution-providers',"coreml"]) command.extend(['--execution-providers',"coreml"])
print(command) print(command)
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
# print(result.stdout.splitlines()[-1]) # print(result.stdout.splitlines()[-1])
if enhancer!="None": if enhancer!="None":
command = [ command = [
@@ -1376,10 +1375,10 @@ class DeepFuzeAdavance:
if device=="gpu": if device=="gpu":
command.extend(['--execution-providers',"coreml"]) command.extend(['--execution-providers',"coreml"])
print(command) print(command)
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
filename = enhanced_filename filename = enhanced_filename
if frame_enhancer!="None": if frame_enhancer!="None":
@@ -1399,10 +1398,10 @@ class DeepFuzeAdavance:
print(command) print(command)
if device=="gpu": if device=="gpu":
command.extend(['--execution-providers',"coreml"]) command.extend(['--execution-providers',"coreml"])
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
temp_file = "/".join(enhanced_filename.split("/")[:-1]) + "_"+enhanced_filename.split("/")[-1] temp_file = "/".join(enhanced_filename.split("/")[:-1]) + "_"+enhanced_filename.split("/")[-1]
subprocess.run(["ffmpeg","-i",enhanced_filename,"-i",audio_file,"-c","copy","-map","0:v:0","-map","1:a:0",temp_file,'-y']) subprocess.run(["ffmpeg","-i",enhanced_filename,"-i",audio_file,"-c","copy","-map","0:v:0","-map","1:a:0",temp_file,'-y'])
filename = temp_file filename = temp_file
@@ -1506,10 +1505,10 @@ class TTS_generation:
'--output_file', file_path, '--output_file', file_path,
'--device', device '--device', device
] ]
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command, cwd="custom_nodes/ComfyUI-DeepFuze",capture_output=True, text=True) result = subprocess.run(command, cwd="custom_nodes/ComfyUI-DeepFuze",capture_output=True, text=True)
print("stdout:", result.stdout) print("stdout:", result.stdout)
print("stderr:", result.stderr) print("stderr:", result.stderr)
@@ -1574,10 +1573,10 @@ class DeepfuzePreview:
'--headless' '--headless'
] ]
print(command) print(command)
if platform == "win32: if platform == "win32":
result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="ComfyUI/custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
else: else:
result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE) result = subprocess.run(command,cwd="custom_nodes/ComfyUI-DeepFuze",stdout=subprocess.PIPE)
print(result.stdout) print(result.stdout)
results.append({ results.append({
"filename": "_"+file, "filename": "_"+file,