Randomize OmniVoice seed and speech-bearing reference excerpts

This commit is contained in:
Mikei386 committed 2026-10-06 11:40:57 +02:00
1 parent 3d192d09b8
commit a9d65ab7d4
6 files changed
+74 -19

No files matched your search

+2 -2
View File
@@ -44,7 +44,7 @@ def generate(family,text,device='3060',reference=None,**options):
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']
arr,rate=sf.read(io.BytesIO(request('/api/v1/voice/audio?id='+job['id'])),dtype='int16');return (rate,arr),'Fertig · '+current['gpu']+(' · Seed '+str(current['seed']) if 'seed' in current else '')+(' · Referenz '+str(round(current['reference_start_seconds'],1))+'–'+str(round(current['reference_end_seconds'],1))+' s' if 'reference_start_seconds' in current else '')
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.')
@@ -58,7 +58,7 @@ def main():
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))
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=-1,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: