Files
Athena-Deck/applio_worker.py
T
Mikei386 06cacafbad Add native Applio RVC and preserve the custom studio UI
Pin Applio 3.6.5 and verified basis assets, migrate private voice provenance, and coordinate conversion/live/training with Deck GPU leases. Prepare an inactive voice profile and a restricted studio container. Move CUDA and Torch caches out of the small temporary filesystem to prevent OmniVoice reference failures. Package app updates from the explicit allowlist in one Docker layer.
2026-10-05 10:02:07 +02:00

26 lines
1.0 KiB
Python

"""Resident RVC inference. stdout is JSON; upstream diagnostics go to stderr."""
import contextlib,ctypes,json,os,signal,sys,traceback
def bind_parent():
if sys.platform=="linux":
parent=os.getppid()
if ctypes.CDLL(None,use_errno=True).prctl(1,signal.SIGTERM,0,0,0)!=0:raise OSError(ctypes.get_errno(),"Worker shutdown guard")
if os.getppid()!=parent:raise SystemExit("Parent process stopped")
def main():
bind_parent()
if len(sys.argv)>1 and sys.argv[1]=="--exec":
os.execv(sys.argv[2],sys.argv[2:])
with contextlib.redirect_stdout(sys.stderr):
from rvc.infer.infer import VoiceConverter
converter=VoiceConverter()
print(json.dumps({'ready':True}),flush=True)
for line in sys.stdin:
try:
data=json.loads(line)
with contextlib.redirect_stdout(sys.stderr):converter.convert_audio(**data)
print(json.dumps({'ok':True}),flush=True)
except Exception as exc:
traceback.print_exc(file=sys.stderr);print(json.dumps({'error':type(exc).__name__+': '+str(exc)}),flush=True)
if __name__=='__main__':main()