mirror of
https://github.com/KwaiVGI/LivePortrait.git
synced 2024-12-22 04:12:38 +00:00
feat: add scripts for one click windows (#219)
* feat: windows one-click installation * chore: format --------- Co-authored-by: zzzweakman <1819489045@qq.com>
This commit is contained in:
parent
172b852127
commit
1f443b2344
4
.gitignore
vendored
4
.gitignore
vendored
@ -22,3 +22,7 @@ tmp/*
|
||||
.vscode/launch.json
|
||||
**/*.DS_Store
|
||||
gradio_temp/**
|
||||
|
||||
# Windows dependencies
|
||||
ffmpeg/
|
||||
LivePortrait_env/
|
||||
|
5
app.py
5
app.py
@ -32,11 +32,14 @@ def fast_check_ffmpeg():
|
||||
tyro.extras.set_accent_color("bright_cyan")
|
||||
args = tyro.cli(ArgumentConfig)
|
||||
|
||||
ffmpeg_dir = os.path.join(os.getcwd(), "ffmpeg")
|
||||
if osp.exists(ffmpeg_dir):
|
||||
os.environ["PATH"] += (os.pathsep + ffmpeg_dir)
|
||||
|
||||
if not fast_check_ffmpeg():
|
||||
raise ImportError(
|
||||
"FFmpeg is not installed. Please install FFmpeg (including ffmpeg and ffprobe) before running this script. https://ffmpeg.org/download.html"
|
||||
)
|
||||
|
||||
# specify configs for inference
|
||||
inference_cfg = partial_fields(InferenceConfig, args.__dict__) # use attribute of args to initial InferenceConfig
|
||||
crop_cfg = partial_fields(CropConfig, args.__dict__) # use attribute of args to initial CropConfig
|
||||
|
@ -1,5 +1,6 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os
|
||||
import os.path as osp
|
||||
import tyro
|
||||
import subprocess
|
||||
@ -33,6 +34,10 @@ def main():
|
||||
tyro.extras.set_accent_color("bright_cyan")
|
||||
args = tyro.cli(ArgumentConfig)
|
||||
|
||||
ffmpeg_dir = os.path.join(os.getcwd(), "ffmpeg")
|
||||
if osp.exists(ffmpeg_dir):
|
||||
os.environ["PATH"] += (os.pathsep + ffmpeg_dir)
|
||||
|
||||
if not fast_check_ffmpeg():
|
||||
raise ImportError(
|
||||
"FFmpeg is not installed. Please install FFmpeg (including ffmpeg and ffprobe) before running this script. https://ffmpeg.org/download.html"
|
||||
|
18
src/utils/check_windows_port.py
Normal file
18
src/utils/check_windows_port.py
Normal file
@ -0,0 +1,18 @@
|
||||
import socket
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python check_port.py <port>")
|
||||
sys.exit(1)
|
||||
|
||||
port = int(sys.argv[1])
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.settimeout(1)
|
||||
result = sock.connect_ex(('127.0.0.1', port))
|
||||
|
||||
if result == 0:
|
||||
print("LISTENING")
|
||||
else:
|
||||
print("NOT LISTENING")
|
||||
sock.close
|
Loading…
Reference in New Issue
Block a user