Add voice control mode, OmniVoice worker and managed voice studios

This commit is contained in:
Mikei386 committed 2026-10-04 21:14:49 +02:00
1 parent 260740994f
commit 5fa8e6de90
33 files changed
+411 -64

No files matched your search

+4
View File
@@ -30,3 +30,7 @@ CMD ["python3", "server.py", "--port", "8108"]
COPY deploy/voxcpm-requirements.lock /app/deploy/voxcpm-requirements.lock
COPY deploy/patch_yue2_residency.py /app/deploy/patch_yue2_residency.py
COPY omnivoice_runtime.py omnivoice_worker.py /app/
COPY deploy/omnivoice-requirements.lock /app/deploy/omnivoice-requirements.lock
+4
View File
@@ -20,3 +20,7 @@ CMD ["python3", "server.py", "--port", "8108"]
COPY deploy/voxcpm-requirements.lock /app/deploy/voxcpm-requirements.lock
COPY deploy/patch_yue2_residency.py /app/deploy/patch_yue2_residency.py
COPY omnivoice_runtime.py omnivoice_worker.py /app/
COPY deploy/omnivoice-requirements.lock /app/deploy/omnivoice-requirements.lock
+12 -8
View File
@@ -53,7 +53,7 @@ def export(manager):
try:relative=str(Path(source).relative_to(deck))
except ValueError:pass
mounts.append(dict(index=i,target=m['Destination'],read_only=not m['RW'],deck_path=relative,files=config_files(source,m['Destination']),was_file=Path(source).is_file()))
result.append(dict(name=row['name'],image=c['Image'],registry=registry,application=c.get('Labels',{}).get(APP,''),labels={k:v for k,v in (c.get('Labels') or {}).items() if k.startswith('io.athena-deck.')},env=c.get('Env') or [],entrypoint=c.get('Entrypoint'),cmd=c.get('Cmd'),uid=app_uid(row['id'],c.get('User') or ''),user=c.get('User') or '',workdir=c.get('WorkingDir') or '',network=h['NetworkMode'],ports=h.get('PortBindings') or {},restart=h.get('RestartPolicy',{}).get('Name') or 'no',memory=h.get('Memory') or 0,nanocpus=h.get('NanoCpus') or 0,running=x['State']['Running'],mounts=mounts,build_recipe='swarm-ui' if row['name']=='athena-swarm-ui' else 'ladypoly' if row['name']=='athena-ladypoly' else 'separator-web' if row['name']=='athena-separator-web' else None,unsupported=bool(h.get('Privileged') or h.get('DeviceRequests') or h.get('Devices') or h.get('CapAdd'))))
result.append(dict(name=row['name'],image=c['Image'],registry=registry,application=c.get('Labels',{}).get(APP,''),labels={k:v for k,v in (c.get('Labels') or {}).items() if k.startswith('io.athena-deck.')},env=c.get('Env') or [],entrypoint=c.get('Entrypoint'),cmd=c.get('Cmd'),uid=app_uid(row['id'],c.get('User') or ''),user=c.get('User') or '',workdir=c.get('WorkingDir') or '',network=h['NetworkMode'],ports=h.get('PortBindings') or {},restart=h.get('RestartPolicy',{}).get('Name') or 'no',memory=h.get('Memory') or 0,nanocpus=h.get('NanoCpus') or 0,running=x['State']['Running'],mounts=mounts,build_recipe='swarm-ui' if row['name']=='athena-swarm-ui' else 'ladypoly' if row['name']=='athena-ladypoly' else 'separator-web' if row['name']=='athena-separator-web' else 'voice-web' if row['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') else None,unsupported=bool(h.get('Privileged') or h.get('DeviceRequests') or h.get('Devices') or h.get('CapAdd'))))
return {'services':result,'configured':bool(deck)}
def validate(c):
@@ -61,9 +61,10 @@ def validate(c):
if any(c.get('labels',{}).get(k)!=v for k,v in LABELS.items()):raise ValueError('Nur ausdrücklich Deck zugeordnete Anwendungscontainer erlaubt.')
if c.get('unsupported'):raise ValueError('GPU-/privilegierter Container benötigt manuelle Einrichtung.')
if c.get('network') not in ('bridge','default','host'):raise ValueError('Benutzerdefiniertes Docker-Netzwerk benötigt manuelle Einrichtung.')
if c.get('network')=='host' and c['name'] not in ('athena-swarm-ui','ltx-deskweb','athena-ladypoly','athena-separator-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.')
if c.get('network')=='host' and c['name'] not in ('athena-swarm-ui','ltx-deskweb','athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.')
recipes={'separator-web':('athena-separator-web','athena-separator-web:0.1.0'),'swarm-ui':('athena-swarm-ui','athena-swarm-ui:de7b834'),'ladypoly':('athena-ladypoly','athena-ladypoly:3960afc-deck1')}
if c.get('build_recipe') is not None and recipes.get(c['build_recipe'])!=(c['name'],c.get('image')):raise ValueError('Unbekanntes Build-Rezept.')
if c.get('build_recipe')=='voice-web' and c['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') and c.get('image')=='athena-voice-web:0.2.1-deck1':pass
elif c.get('build_recipe') is not None and recipes.get(c['build_recipe'])!=(c['name'],c.get('image')):raise ValueError('Unbekanntes Build-Rezept.')
ref=c.get('registry') or c.get('image','')
if not isinstance(ref,str) or not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9._/@:-]{0,300}',ref):raise ValueError('Ungültige Image-Referenz.')
if c.get('restart') not in ('no','always','unless-stopped','on-failure'):raise ValueError('Ungültige Neustartregel.')
@@ -97,7 +98,7 @@ def validate(c):
if rel is not None and not native_media and (rel not in ('models','video/comfy-work/models','video/comfy-client-token') or not m['read_only']):raise ValueError('Deck-Volume nicht freigegeben; nur bekannte Modell-/Tokenpfade und LTX-Medienordner erlaubt.')
for name,data in m.get('files',{}).items():
allowed=('file','Settings.fds','Backends.fds')
if c['name'] in ('athena-ladypoly','athena-separator-web') and m['target']=='/data':allowed+=('settings.json','deck-connection.json')
if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web') and m['target']=='/data':allowed+=('settings.json','deck-connection.json')
if name not in allowed:raise ValueError('Unbekannte Konfigurationsdatei.')
if not isinstance(data,str) or len(base64.b64decode(data,validate=True))>MAX_FILE:raise ValueError('Ungültige Konfigurationsdatei.')
return c
@@ -115,11 +116,14 @@ def restore(manager,c):
# Never replace or restart an existing service during a restore.
if x['Config']['Image'] not in (c['image'],c.get('registry')):raise ValueError('Vorhandener Container verwendet ein anderes Image; manuell prüfen.')
return {'state':'reused','message':'Vorhandener markierter Container unverändert übernommen.'}
if c['name'] in ('athena-ladypoly','athena-separator-web'):
with socket.socket() as probe:probe.bind(('127.0.0.1',8127 if c['name']=='athena-ladypoly' else 8128))
if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web'):
if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web'):
with socket.socket() as probe:probe.bind(('127.0.0.1',{'athena-ladypoly':8127,'athena-separator-web':8128,'athena-voxcpm2-web':8129,'athena-omnivoice-web':8130}[c['name']]))
if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web'):
source=Path(__file__).parent/c['build_recipe']
if not (source/'Dockerfile').is_file():raise ValueError('Gepinntes Swarm-Build-Rezept fehlt im Systemhelfer.')
if c['build_recipe']=='voice-web':
exists=subprocess.run(['/usr/bin/docker','image','inspect','mike-ai/omnivoice-studio:0.2.1'],capture_output=True)
if exists.returncode:command(['build','-f',str(source/'base.Dockerfile'),'-t','mike-ai/omnivoice-studio:0.2.1',str(source)],1800)
command(['build','-t',c['image'],str(source)],1800)
else:
if not c.get('registry'):raise ValueError('Lokales Image hat keine Registry-Quelle und kein bekanntes Build-Rezept.')
@@ -142,7 +146,7 @@ def restore(manager,c):
if base.is_symlink():raise ValueError('Unsicheres Dienstverzeichnis.')
base.mkdir(parents=True,exist_ok=True,mode=0o700)
args=['create','--name',name,'--network',c['network'],'--restart',c['restart'],'--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','256']
if c['name'] in ('athena-ladypoly','athena-separator-web'):
if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web'):
args+=['--read-only','--tmpfs','/tmp:rw,noexec,nosuid,size='+('1g' if c['name']=='athena-separator-web' else '128m')+',uid=65534,gid=65534']
if c['memory']:args+=['--memory',str(c['memory'])]
if c['nanocpus']:args+=['--cpus',str(c['nanocpus']/1e9)]
+1 -1
View File
@@ -14,7 +14,7 @@ import urllib.request
ROOT = Path(__file__).resolve().parent.parent
LABEL = 'de.casaderoll.athena-deck.standalone'
FILES = ['deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
FILES = ['deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
def run(*args, check=True, interactive=False):
+9
View File
@@ -0,0 +1,9 @@
# Versions verified with OmniVoice 0.2.1 on Athena, 2026-10-04.
omnivoice==0.2.1
transformers==5.17.0
tokenizers==0.23.2
accelerate==1.15.0
soundfile==0.14.0
numpy==2.5.2
torch==2.11.0
torchaudio==2.11.0
+3
View File
@@ -31,6 +31,9 @@ def main():
(base/'separator-web').mkdir(exist_ok=True)
for name in ('Dockerfile','app.py','index.html'):
shutil.copyfile(Path(__file__).parent/'separator-web'/name,base/'separator-web'/name)
(base/'voice-web').mkdir(exist_ok=True)
for name in ('Dockerfile','base.Dockerfile','bridge.py'):
shutil.copyfile(Path(__file__).parent/'voice-web'/name,base/'voice-web'/name)
if args.deck_state:
registered=Path(args.deck_state).resolve()
if not registered.is_dir():raise SystemExit('Deck-Zustandsverzeichnis fehlt.')
+9
View File
@@ -0,0 +1,9 @@
# Keep the former OmniVoice web UI and its version. Containers only serve UI;
# Deck's native workers own GPU/model execution.
FROM mike-ai/omnivoice-studio:0.2.1
WORKDIR /ui
COPY bridge.py /ui/bridge.py
ENV GRADIO_ANALYTICS_ENABLED=False HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 VOICE_PORT=8129 VOICE_FAMILY=openbmb/VoxCPM2
ENTRYPOINT ["python", "/ui/bridge.py"]
CMD []
HEALTHCHECK NONE
+23
View File
@@ -0,0 +1,23 @@
# Stimmstudios
VoxCPM2 Studio: `athena-voxcpm2-web`, Port 8129.
OmniVoice Studio: `athena-omnivoice-web`, Port 8130.
Beide sind reine Oberflächen ohne GPU-Freigabe. OmniVoice verwendet die
Gradio-Oberfläche der bisherigen Router-Version 0.2.1. VoxCPM2 bietet Text,
Voice Design (Beschreibung in Klammern) und Referenzstimmen über Gradio.
Aufträge gehen an Decks geschützte `/api/v1/voice/*`-Routen. Das gewünschte
Profil muss in Deck freigegeben sein; nur ein Stimmprofil kann aktiv sein.
In der Steuerung Stimmwerkzeuge starten. Die zugeordnete native Laufzeit
lädt beim Auftrag; anschließend wird das Stimmmodell entladen.
OmniVoice-Klonen benötigt das Transkript der Referenz, damit kein zusätzlicher
Whisper-Download und keine unkontrollierte ASR-GPU-Ausführung stattfinden.
`/data/deck-connection.json` enthält den Deck-Verbindungswert, Berechtigung 0600.
Die Datei wird vom verschlüsselten Konfigurationsbackup erfasst. Images können
mit dem hinterlegten Build-Rezept wiederhergestellt werden. Die Gewichte
bleiben in Decks Bibliothek mit Originalquelle und Prüfsummen.
Container lauschen ausschließlich auf Loopback (Host-Netzwerk). Ports 8129
und 8130 im nativen Netzwerkhelfer registrieren; dessen Zugriffspolitik und
dynamische WireGuard-Adresse gelten auch für diese Studios.
+7
View File
@@ -0,0 +1,7 @@
FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl ffmpeg libsndfile1 python3 python3-pip python3-venv && rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"
RUN python -m pip install --no-cache-dir torch==2.8.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
RUN python -m pip install --no-cache-dir omnivoice==0.2.1 omnivoice-triton==0.1.0 'num2words>=0.5.14'
CMD ["omnivoice-demo","--ip","0.0.0.0","--port","8008"]
+83
View File
@@ -0,0 +1,83 @@
"""UI-only bridge: all GPU execution and profile selection remain in Athena Deck."""
import io,json,os,time,urllib.request,urllib.error,wave
from pathlib import Path
CONFIG=Path('/data/deck-connection.json')
BASE='http://127.0.0.1:8108'
def request(path,data=None,ctype='application/json'):
token=json.loads(CONFIG.read_text()).get('token','') if CONFIG.exists() else ''
if not token:raise ValueError('Deck-Verbindung zuerst einrichten.')
req=urllib.request.Request(BASE+path,data=data,headers={'Authorization':'Bearer '+token,'Content-Type':ctype})
try:
with urllib.request.urlopen(req,timeout=90) as r:return r.read()
except urllib.error.HTTPError as exc:
try:error=json.loads(exc.read()).get('error','Deck-Anfrage abgelehnt')
except Exception:error='Deck-Anfrage abgelehnt (HTTP '+str(exc.code)+')'
raise ValueError(error if isinstance(error,str) else error.get('message','Deck-Anfrage abgelehnt')) from None
def connect(token):
if not token:raise ValueError('API-Token eingeben.')
# Check before persisting; keep token out of output and logs.
req=urllib.request.Request(BASE+'/api/v1/voice/profiles',headers={'Authorization':'Bearer '+token})
with urllib.request.urlopen(req,timeout=10) as r:
if r.status!=200:raise ValueError('Deck-Verbindung nicht bestätigt.')
CONFIG.parent.mkdir(parents=True,exist_ok=True);tmp=CONFIG.with_suffix('.tmp');tmp.write_text(json.dumps({'token':token}));tmp.chmod(0o600);tmp.replace(CONFIG)
return 'Deck verbunden. In Deck das gewünschte Stimmprofil aktivieren und Stimmwerkzeuge starten.'
def generate(family,text,device='3060',reference=None,**options):
rows=json.loads(request('/api/v1/voice/profiles'))['profiles']
p=next((p for p in rows if p['repo']==family and p['enabled'] and p['runnable']),None)
if not p:raise ValueError('Dieses Stimmprofil zuerst in Deck aktivieren. Es darf nur ein Stimmprofil aktiv sein.')
data=dict(profile_id=p['id'],text=text,device=device,**options)
ctype='application/json'
if reference:
import soundfile as sf
arr,rate=sf.read(reference);buf=io.BytesIO();sf.write(buf,arr,rate,format='WAV',subtype='PCM_16');audio=buf.getvalue()
boundary='athena-voice-'+os.urandom(12).hex();parts=[]
for k,v in data.items():
value=str(v).lower() if isinstance(v,bool) else str(v)
parts.append(('--'+boundary+'\r\nContent-Disposition: form-data; name="'+k+'"\r\n\r\n'+value+'\r\n').encode())
parts.extend([('--'+boundary+'\r\nContent-Disposition: form-data; name="file"; filename="reference.wav"\r\nContent-Type: audio/wav\r\n\r\n').encode(),audio,('\r\n--'+boundary+'--\r\n').encode()]);body=b''.join(parts);ctype='multipart/form-data; boundary='+boundary
else:body=json.dumps(data).encode()
job=json.loads(request('/api/v1/voice/start',body,ctype));deadline=time.monotonic()+650
while time.monotonic()<deadline:
current=json.loads(request('/api/v1/voice'))['job']
if not current or current['id']!=job['id']:raise ValueError('Auftrag nicht mehr verfügbar.')
if current['state']=='complete':
import soundfile as sf
arr,rate=sf.read(io.BytesIO(request('/api/v1/voice/audio?id='+job['id'])),dtype='int16');return (rate,arr),'Fertig · '+current['gpu']
if current['state']!='running':raise ValueError(current['phase'])
time.sleep(.5)
raise ValueError('Deck-Auftrag dauert länger als erwartet. Status in Deck prüfen.')
def main():
import gradio as gr
family=os.environ['VOICE_FAMILY'];port=int(os.environ['VOICE_PORT'])
if family=='k2-fsa/OmniVoice':
# Reuse the exact OmniVoice demo shipped by the old router, replacing only
# generation with Deck requests. No weights or CUDA access in this container.
from omnivoice.cli.demo import build_demo
from types import SimpleNamespace
def gen(text,language,ref_audio,instruct,num_step,guidance_scale,denoise,speed,duration,preprocess_prompt,postprocess_output,mode,ref_text=None):
try:return generate(family,text,reference=ref_audio if mode=='clone' else None,reference_text=ref_text or '',language='' if language=='Auto' else language or '',instruct=instruct or '',steps=int(num_step or 32),cfg=float(guidance_scale if guidance_scale is not None else 2),seed=42,speed=float(speed or 1),duration=float(duration or 0),denoise=bool(denoise),preprocess_prompt=bool(preprocess_prompt),postprocess_output=bool(postprocess_output))
except Exception as exc:return None,str(exc) if isinstance(exc,ValueError) else 'Deck-Verbindung prüfen.'
demo=build_demo(SimpleNamespace(sampling_rate=24000),'Athena Deck · OmniVoice',generate_fn=gen)
with demo:
with gr.Accordion('Athena Deck-Verbindung',open=not CONFIG.exists()):
token=gr.Textbox(label='Deck API-Token',type='password');save=gr.Button('Verbinden');status=gr.Textbox(label='Verbindung',interactive=False);save.click(connect,token,status)
else:
with gr.Blocks(title='Athena VoxCPM2 Studio') as demo:
gr.Markdown('# VoxCPM2 Studio\nSprachausgabe, Voice Design und Stimmklonen. Verarbeitung über Athena Deck. Profil dort aktivieren; Stimmwerkzeuge starten.')
with gr.Accordion('Deck-Verbindung',open=not CONFIG.exists()):
token=gr.Textbox(label='Deck API-Token',type='password');save=gr.Button('Verbinden');status=gr.Textbox(interactive=False);save.click(connect,token,status)
text=gr.Textbox(label='Text (Voice Design: Beschreibung in Klammern voranstellen)',lines=5)
ref=gr.Audio(label='Referenzstimme (optional, 1–30 Sekunden)',type='filepath')
device=gr.Dropdown(['3060','5080'],value='3060',label='GPU')
with gr.Row():
cfg=gr.Slider(.5,5,value=2,step=.1,label='Guidance');steps=gr.Slider(1,50,value=10,step=1,label='Schritte');seed=gr.Number(value=42,precision=0,label='Seed')
button=gr.Button('Stimme erzeugen',variant='primary');output=gr.Audio(label='Ergebnis');message=gr.Textbox(label='Status',interactive=False)
def gen(text,ref,device,cfg,steps,seed):
try:return generate(family,text,device,ref,cfg=float(cfg),steps=int(steps),seed=int(seed))
except Exception as exc:return None,str(exc) if isinstance(exc,ValueError) else 'Deck-Verbindung prüfen.'
button.click(gen,[text,ref,device,cfg,steps,seed],[output,message])
demo.queue(default_concurrency_limit=1).launch(server_name='127.0.0.1',server_port=port,show_error=False,allowed_paths=['/tmp'],max_file_size='8mb')
if __name__=='__main__':main()