Integrate tested Seed-VC GPU conversion into Stimmatelier
This commit is contained in:
1 parent
73e803e943
commit
1445152fec
22 files changed
+688
-17
No files matched your search
+15
-8
@@ -263,6 +263,7 @@ class Endpoint:
|
||||
if self.music:self.music.stop()
|
||||
if self.tts:self.tts.stop()
|
||||
if getattr(self,'pocket',None):self.pocket.stop()
|
||||
if getattr(self,'seedvc',None):self.seedvc.stop()
|
||||
if getattr(self,'humaneness',None):self.humaneness.stop()
|
||||
if getattr(self,'qwen_native',None):self.qwen_native.stop()
|
||||
if self.embeddings:self.embeddings.stop()
|
||||
@@ -293,7 +294,8 @@ class Endpoint:
|
||||
if not (p['enabled'] and p['runnable'] and p['kind']==kind):continue
|
||||
if kind=='voice':
|
||||
from humaneness_runtime import supported as humaneness_model
|
||||
if humaneness_model(p.get('model')):continue
|
||||
from seedvc_runtime import supported as seedvc_model
|
||||
if humaneness_model(p.get('model')) or seedvc_model(p.get('model')):continue
|
||||
from applio import applio_model
|
||||
from xvc import xvc_model
|
||||
from soulx_singer import soulx_singer_model
|
||||
@@ -383,20 +385,24 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
if self.command=='GET' and parsed.path=='/health':
|
||||
return self.send({'status':'ok','service':'athena-deck-api'})
|
||||
if parsed.path=='/v1/audio/voice-conversions/models' and self.command=='GET':
|
||||
from humaneness_runtime import supported
|
||||
from humaneness_runtime import supported as hvc_supported
|
||||
from seedvc_runtime import supported as seed_supported
|
||||
supported=lambda m:hvc_supported(m) or seed_supported(m)
|
||||
return self.send({'object':'list','data':[{'id':p['api_id'],'name':p['name'],'object':'model','task':'voice-conversion'} for p in ep.rows() if p['enabled'] and p['runnable'] and supported(p.get('model'))]})
|
||||
if parsed.path=='/v1/audio/voice-conversions' and self.command=='POST':
|
||||
from humaneness import read_upload
|
||||
try:
|
||||
model,source,reference,options=read_upload(self,field='model');p=ep.find_profile(model,'voice')
|
||||
model,source,reference,options=read_upload(self,field='model',validator=lambda a:a,reference_required=False);p=ep.find_profile(model,'voice')
|
||||
from humaneness_runtime import supported
|
||||
if not supported(p.get('model')):raise ValueError('Kein Voice-Conversion-Profil.')
|
||||
job=ep.humaneness.start(p['id'],source,reference,wait=True,**options);deadline=time.monotonic()+800
|
||||
from seedvc_runtime import supported as seed_supported
|
||||
backend=ep.seedvc if seed_supported(p.get('model')) else ep.humaneness
|
||||
if not (supported(p.get('model')) or seed_supported(p.get('model'))):raise ValueError('Kein Voice-Conversion-Profil.')
|
||||
job=backend.start(p['id'],source,reference,wait=True,**options);deadline=time.monotonic()+1900
|
||||
while time.monotonic()<deadline:
|
||||
status=ep.humaneness.status()['job']
|
||||
status=backend.status()['job']
|
||||
if not status or status['id']!=job['id']:raise ValueError('Auftragsstatus ersetzt.')
|
||||
if status['state']=='complete':
|
||||
audio=ep.humaneness.audio(job['id']);self.sent=True;self.send_response(200);self.compatibility_headers();self.send_header('Content-Type','audio/wav');self.send_header('Content-Length',str(len(audio)));self.send_header('Cache-Control','no-store');self.send_header('Connection','close');self.end_headers();self.wfile.write(audio);return
|
||||
audio=backend.audio(job['id']);self.sent=True;self.send_response(200);self.compatibility_headers();self.send_header('Content-Type','audio/wav');self.send_header('Content-Length',str(len(audio)));self.send_header('Cache-Control','no-store');self.send_header('Connection','close');self.end_headers();self.wfile.write(audio);return
|
||||
if status['state']!='running':raise ValueError(status['phase'])
|
||||
time.sleep(.2)
|
||||
raise ValueError('Voice-Conversion-Zeitlimit erreicht.')
|
||||
@@ -496,7 +502,8 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
if len(candidates)!=1:raise APIError('Für model=tts genau ein TTS-Profil am Endpunkt freigeben.',409,'tts_default_ambiguous')
|
||||
data=dict(data,model=candidates[0].get('api_id',candidates[0]['name']))
|
||||
from humaneness_runtime import supported as humaneness_model
|
||||
if any(humaneness_model(p.get('model')) and data.get('model')==p.get('api_id') and p['enabled'] for p in ep.rows()):raise APIError('Dieses Profil benötigt Quellaufnahme und Referenz über /v1/audio/voice-conversions, keinen TTS-Text.')
|
||||
from seedvc_runtime import supported as seedvc_model
|
||||
if any((humaneness_model(p.get('model')) or seedvc_model(p.get('model'))) and data.get('model')==p.get('api_id') and p['enabled'] for p in ep.rows()):raise APIError('Dieses Profil benötigt Quellaufnahme und Referenz über /v1/audio/voice-conversions, keinen TTS-Text.')
|
||||
if not ep.tts:raise APIError('TTS-Laufzeit nicht eingerichtet.',501)
|
||||
if set(data)-{'model','input','voice','response_format','speed','language'}:raise APIError('Nicht unterstützte TTS-Felder.')
|
||||
if getattr(ep,'config',{}).get('tts_text_enhancer',False):
|
||||
|
||||
Reference in new issue
Block a user