From 7d79bf8e5a12bedc9216ea94bbcea6e8e1736ae6 Mon Sep 17 00:00:00 2001 From: Kasisnu <5044120+kasisnu@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:04:18 +0530 Subject: [PATCH] add facefusion runner --- workflows/comfy/facefusion-runner.sh | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 workflows/comfy/facefusion-runner.sh diff --git a/workflows/comfy/facefusion-runner.sh b/workflows/comfy/facefusion-runner.sh new file mode 100755 index 0000000..99b29fb --- /dev/null +++ b/workflows/comfy/facefusion-runner.sh @@ -0,0 +1,53 @@ +#! /bin/bash +set -ex + +# we're invoked as +# ./facefusion-runner.sh --input-audio $input_audio --input-video --output $output +LONGOPTS=input_audio:,input_video:,output: +OPTIONS=a:v:o: + +PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") || exit 2 +# read getopt’s output this way to handle the quoting right: +eval set -- "$PARSED" + + +while true; do + case "$1" in + -a|--input_audio) + input_audio="$2" + shift 2 + ;; + -v|--input_video) + input_video="$2" + shift 2 + ;; + -o|--output) + output="$2" + shift 2 + ;; + --) + shift + break + ;; + *) + echo "Programming error" + exit 3 + ;; + esac +done + +echo "input_audio: $input_audio" +echo "input_video: $input_video" +echo "output: $output" + +export input_audio +export input_video +export output + +deactivate || true + +cd /facefusion +# Set up the environment +source venv/bin/activate +venv/bin/python3 -m pip install -r requirements.txt +venv/bin/python3 run.py -s $input_audio -t $input_video --frame-processors lip_syncer -o $output --headless \ No newline at end of file