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.
32 lines
2.3 KiB
Python
32 lines
2.3 KiB
Python
"""Merge the prepared inactive Applio profile only while Deck is stopped."""
|
|
import json,os,secrets,subprocess,sys
|
|
from pathlib import Path
|
|
sys.path.insert(0,str(Path(__file__).resolve().parent.parent))
|
|
from catalog import Catalog
|
|
from profiles import Profiles
|
|
|
|
def activate(state):
|
|
state=Path(state);pending=state/'applio-profile-pending.json'
|
|
row=json.loads(pending.read_text());profiles=Profiles(state/'profiles.json',Catalog(state/'models'))
|
|
existing=next((p for p in profiles.rows if p.get('api_id')==row['api_id']),None)
|
|
if existing:
|
|
if existing['model_id']!=row['model_id']:raise ValueError('Applio API-ID bereits anders belegt.')
|
|
else:
|
|
profiles.save(dict(id=None,revision=0,name=row['name'],api_id=row['api_id'],kind='voice',model_id=row['model_id'],parameters={}))
|
|
os.chown(state/'profiles.json',65534,65534)
|
|
print('Applio RVC vorbereitet; Endpunktfreigabe und Betriebsart unverändert.')
|
|
def create_ui(state):
|
|
state=Path(state).resolve();name='athena-applio-web'
|
|
found=subprocess.run(['docker','inspect',name],capture_output=True,text=True)
|
|
if found.returncode==0:
|
|
row=json.loads(found.stdout)[0];labels=row['Config'].get('Labels') or {}
|
|
if labels.get('io.athena-deck.managed')!='true' or labels.get('io.athena-deck.application')!='applio-web':raise ValueError('Containername anderweitig belegt.')
|
|
print('Vorhandener Applio-UI-Container bleibt unverändert.');return
|
|
root=state/'applio-data';root.mkdir(parents=True,exist_ok=True);key=root/'bridge-key'
|
|
if not key.exists():key.write_text(secrets.token_urlsafe(48));key.chmod(0o600);os.chown(key,65534,65534)
|
|
subprocess.run(['docker','create','--name',name,'--network','host','--restart','unless-stopped','--label','io.athena-deck.managed=true','--label','io.athena-deck.role=application','--label','io.athena-deck.application=applio-web','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','128','--memory','512m','--cpus','1','--tmpfs','/tmp:rw,noexec,nosuid,size=128m,uid=65534,gid=65534','--mount','type=bind,src='+str(key)+',dst=/run/secrets/applio-bridge,readonly','athena-applio-web:3.6.5-deck1'],check=True,stdout=subprocess.DEVNULL)
|
|
print('Applio-UI-Container angelegt, noch nicht gestartet.')
|
|
if __name__=='__main__':
|
|
if '--ui-container' in sys.argv:create_ui(sys.argv[1])
|
|
else:activate(sys.argv[1])
|