mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-27 08:58:13 +00:00
facefusion: minor updates to runner
This commit is contained in:
@@ -3,8 +3,8 @@ set -ex
|
|||||||
|
|
||||||
# we're invoked as
|
# we're invoked as
|
||||||
# ./facefusion-runner.sh --input-audio $input_audio --input-video --output $output
|
# ./facefusion-runner.sh --input-audio $input_audio --input-video --output $output
|
||||||
LONGOPTS=input_audio:,input_video:,output:
|
LONGOPTS=input_audio:,input_video:,output:,tmpdir:
|
||||||
OPTIONS=a:v:o:
|
OPTIONS=a:v:o:t
|
||||||
|
|
||||||
PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") || exit 2
|
PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@") || exit 2
|
||||||
# read getopt’s output this way to handle the quoting right:
|
# read getopt’s output this way to handle the quoting right:
|
||||||
@@ -25,6 +25,10 @@ while true; do
|
|||||||
output="$2"
|
output="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-t|--tmpdir)
|
||||||
|
tmpdir="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@@ -36,13 +40,29 @@ while true; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -z "$tmpdir" ]; then
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
fi
|
||||||
|
TEMPDIR=$tmpdir
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# rename /tmp/downloads_long_lived/temp_face_fusion_2.niZOOlINrFkE/audio.bin to /tmp/downloads_long_lived/temp_face_fusion_2.niZOOlINrFkE/audio.wav
|
||||||
|
cp $input_audio $TEMPDIR/audio.wav
|
||||||
|
# rename /tmp/downloads_long_lived/temp_face_fusion_2.niZOOlINrFkE/image_or_video.bin to /tmp/downloads_long_lived/temp_face_fusion_2.niZOOlINrFkE/image_or_video.mp4
|
||||||
|
cp $input_video $TEMPDIR/image_or_video.mp4
|
||||||
|
|
||||||
echo "input_audio: $input_audio"
|
echo "input_audio: $input_audio"
|
||||||
echo "input_video: $input_video"
|
echo "input_video: $input_video"
|
||||||
echo "output: $output"
|
echo "output: $output"
|
||||||
|
echo "tmpdir: $tmpdir"
|
||||||
|
|
||||||
export input_audio
|
export input_audio
|
||||||
export input_video
|
export input_video
|
||||||
export output
|
export output
|
||||||
|
export TEMPDIR
|
||||||
|
|
||||||
|
|
||||||
deactivate || true
|
deactivate || true
|
||||||
|
|
||||||
@@ -50,10 +70,8 @@ cd /facefusion
|
|||||||
# Set up the environment
|
# Set up the environment
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
|
|
||||||
TEMPDIR=$(mktemp -d)
|
|
||||||
|
|
||||||
|
venv/bin/python3 run.py -s $TEMPDIR/audio.wav -t $TEMPDIR/image_or_video.mp4 --frame-processors lip_syncer --execution-provider cuda -o $TEMPDIR/1.mp4 --headless
|
||||||
venv/bin/python3 run.py -s $input_audio -t $input_video --frame-processors lip_syncer --execution-provider cuda -o $TEMPDIR/1.mp4 --headless
|
venv/bin/python3 run.py -s $TEMPDIR/audio.wav -t $TEMPDIR/1.mp4 --frame-processors face_enhancer --execution-provider cuda -o $output --headless
|
||||||
venv/bin/python3 run.py -s $input_audio -t $TEMPDIR/1.mp4 --frame-processors face_enhancer --execution-provider cuda -o $output --headless
|
|
||||||
|
|
||||||
# rm -rf $TEMPDIR
|
# rm -rf $TEMPDIR
|
||||||
Reference in New Issue
Block a user