Initial lip-sync service with command backend
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
param(
|
||||
[string]$ApiUrl = "http://127.0.0.1:7860/",
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Audio,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Video
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
|
||||
$Python = Join-Path $Root ".venv\Scripts\python.exe"
|
||||
if (!(Test-Path -LiteralPath $Python)) {
|
||||
$Python = "py"
|
||||
}
|
||||
|
||||
$code = @"
|
||||
import json
|
||||
import sys
|
||||
from gradio_client import Client, handle_file
|
||||
|
||||
api_url, audio, video = sys.argv[1:4]
|
||||
client = Client(api_url)
|
||||
result = client.predict(
|
||||
audio_file=handle_file(audio),
|
||||
video_file={"video": handle_file(video)},
|
||||
api_name="/process_single",
|
||||
)
|
||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||
"@
|
||||
|
||||
if ($Python -eq "py") {
|
||||
py -3 -c $code $ApiUrl $Audio $Video
|
||||
} else {
|
||||
& $Python -c $code $ApiUrl $Audio $Video
|
||||
}
|
||||
Reference in New Issue
Block a user