Prepare pinned Humaneness voice conversion runtime and API integration
This commit is contained in:
1 parent
0659967f36
commit
7cf12d4fd1
22 files changed
+693
-18
No files matched your search
+24
@@ -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,'humaneness',None):self.humaneness.stop()
|
||||
if getattr(self,'qwen_native',None):self.qwen_native.stop()
|
||||
if self.embeddings:self.embeddings.stop()
|
||||
if self.voxcpm:self.voxcpm.stop()
|
||||
@@ -291,6 +292,8 @@ class Endpoint:
|
||||
for p in self.rows():
|
||||
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 applio import applio_model
|
||||
from xvc import xvc_model
|
||||
from soulx_singer import soulx_singer_model
|
||||
@@ -379,6 +382,25 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
return self.send(ep.model_properties(name))
|
||||
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
|
||||
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=read_upload(self,field='model');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);deadline=time.monotonic()+610
|
||||
while time.monotonic()<deadline:
|
||||
status=ep.humaneness.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
|
||||
if status['state']!='running':raise ValueError(status['phase'])
|
||||
time.sleep(.2)
|
||||
raise ValueError('Voice-Conversion-Zeitlimit erreicht.')
|
||||
except (OSError,ValueError) as exc:raise APIError(str(exc)) from None
|
||||
if ep.scheduler.gpu_mode=='voice' and parsed.path not in ('/v1/audio/speech','/v1/audio/speech/models','/v1/embeddings','/v1/embeddings/models'):raise APIError('Stimmwerkzeuge aktiv. Für andere KI-Aufträge die Betriebsart wechseln.',503,'voice_mode_active')
|
||||
if ep.scheduler.gpu_mode=='separator' and self.path not in ('/v1/embeddings','/v1/embeddings/models'):raise APIError('Audio-Trennung aktiv. Für Chat, Bilder oder Musik die Betriebsart wechseln.',503,'separator_mode_active')
|
||||
if ep.video and ep.scheduler.gpu_mode not in ('llm','music','voice') and self.path not in ('/v1/embeddings','/v1/embeddings/models'):
|
||||
@@ -473,6 +495,8 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
candidates=[p for p in ep.rows() if p['enabled'] and (p['kind']=='audio' or p.get('model') and voice_recipe(p['model']))]
|
||||
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.')
|
||||
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