Prepare pinned Humaneness voice conversion runtime and API integration

This commit is contained in:
Mikei386 committed 2026-10-19 13:56:49 +02:00
1 parent 0659967f36
commit 7cf12d4fd1
22 files changed
+693 -18

No files matched your search

+27 -3
View File
@@ -25,7 +25,7 @@ from separator import SeparatorTests
from image_test import ImageTests
from prompt_enhancer import PromptEnhancer
from docker_support import DockerSupport
from inference import LlamaWorker,Scheduler
from inference import LlamaWorker,Scheduler,InferenceError
from strata_runtime import StrataRuntime
from strata_worker import StrataWorker,ChatWorkerRouter
from endpoint import Endpoint
@@ -176,6 +176,18 @@ class Server(ThreadingHTTPServer):
self.endpoint.pocket=self.pocket
self.endpoint.qwen_native=self.qwen_native
self.endpoint.voxcpm=self.voxcpm_tests
from humaneness_runtime import HumanenessRuntime,supported as humaneness_model
from humaneness import Humaneness
self.humaneness_runtime=HumanenessRuntime(self.catalog.root.parent/'humaneness-runtime')
self.humaneness=Humaneness(self.catalog.root.parent/'humaneness-jobs',self.humaneness_runtime,self.profiles,self.scheduler)
self.profiles.humaneness_blockers=self.humaneness.blockers;self.endpoint.humaneness=self.humaneness
model_id=self.humaneness_runtime.register(self.catalog)
marker=self.humaneness_runtime.root/'profile-created'
if model_id and not marker.exists():
from profiles import SCHEMAS
if not any(humaneness_model(p.get('model')) for p in self.profiles.status()['profiles']):
self.profiles.save(dict(id=None,revision=0,name='Humaneness Voice Conversion',api_id='humaneness-vc',kind='voice',model_id=model_id,parameters={k:v[2] for k,v in SCHEMAS['voice'].items()}))
marker.write_text('Humaneness profile registered; endpoint publication requires GUI\n')
self.endpoint.stt=self.stt
from applio import Applio
self.applio=Applio(self.catalog.root.parent/'applio-data',self.applio_runtime,self.scheduler,self.profiles,lambda:self.endpoint.config['enabled_profiles'])
@@ -197,7 +209,7 @@ class Server(ThreadingHTTPServer):
self.chat_tests=ChatTests(self.profiles,self.worker,self.scheduler)
self.auto_tests=AutoTests(self.catalog.root.parent/'auto-tests.json',self.profiles,self.worker,self.scheduler)
def stop_gpu_work():
self.qwen_native.stop();self.pocket.stop();self.strata_runtime.stop();self.remix.stop();self.voxcpm_tests.stop();self.separator_tests.stop();self.music.close();self.auto_tests.stop();self.chat_tests.stop();self.image_tests.stop();self.prompt_enhancer.stop_preview();self.tts_tests.stop();self.worker.stop()
self.humaneness.stop();self.qwen_native.stop();self.pocket.stop();self.strata_runtime.stop();self.remix.stop();self.voxcpm_tests.stop();self.separator_tests.stop();self.music.close();self.auto_tests.stop();self.chat_tests.stop();self.image_tests.stop();self.prompt_enhancer.stop_preview();self.tts_tests.stop();self.worker.stop()
from video_original import VideoRuntimes
from ltx_original_runtime import LTXOriginalRuntime
from audio_cpp_runtime import AudioCppRuntime
@@ -295,6 +307,7 @@ class Server(ThreadingHTTPServer):
threading.Thread(target=preload_music,daemon=True).start()
def server_close(self):
if getattr(self,'humaneness',None):self.humaneness.stop()
if getattr(self,'soulx_singer',None):self.soulx_singer.stop()
if getattr(self,'xvc',None):self.xvc.stop()
if getattr(self,'applio',None):self.applio.stop()
@@ -451,7 +464,7 @@ class Handler(BaseHTTPRequestHandler):
else self.server.video.runtime)
return {'embeddings':chat,'stt':chat,'chat':chat,
'image':self.server.image_runtime.status().get('installed',False),
'qwen_native':self.server.qwen_native_runtime.status()['installed'],'pocket':self.server.pocket_runtime.status()['installed'],'audio':self.server.tts_runtime.status().get('installed',False),'parakeet':self.server.stt.parakeet.status()['installed'],
'humaneness':self.server.humaneness_runtime.status()['installed'],'qwen_native':self.server.qwen_native_runtime.status()['installed'],'pocket':self.server.pocket_runtime.status()['installed'],'audio':self.server.tts_runtime.status().get('installed',False),'parakeet':self.server.stt.parakeet.status()['installed'],
'video':video_runtime.status().get('installed',False),
'acestep':self.server.acestep_runtime.status()['installed'],
'audio_cpp':self.server.audio_cpp_runtime.status()['installed'],
@@ -494,6 +507,10 @@ class Handler(BaseHTTPRequestHandler):
if self.path == '/api/v1/docker':return self.respond(self.server.docker.status())
if self.path == '/api/v1/stt':return self.respond(self.server.stt.status())
if self.path == '/api/v1/voice/profiles':return self.respond({'profiles':[dict(id=p['id'],name=p['name'],repo=p['model']['repo'],enabled=p['enabled'],runnable=p['runnable']) for p in self.server.endpoint.rows() if p['kind']=='voice' and p.get('model')]})
if self.path == '/api/v1/conversion':return self.respond(self.server.humaneness.status())
if urlsplit(self.path).path == '/api/v1/conversion/audio':
try:return self.respond(self.server.humaneness.audio(parse_qs(urlsplit(self.path).query).get('id',[''])[0]),mime='audio/wav')
except (OSError,ValueError) as exc:return self.respond({'error':str(exc)},400)
if self.path == '/api/v1/voice':return self.respond(dict(self.server.voxcpm_tests.status(),mode=self.server.scheduler.gpu_mode))
if urlsplit(self.path).path == '/api/v1/voice/audio':
try:return self.respond(self.server.voxcpm_tests.audio(parse_qs(urlsplit(self.path).query).get('id',[''])[0]),mime='audio/wav')
@@ -887,6 +904,13 @@ class Handler(BaseHTTPRequestHandler):
if not selected:raise ValueError('Dieses Stimmprofil ist nicht aktiviert. In Deck das gewünschte Profil freigeben.')
return self.respond(self.server.voxcpm_tests.start(**fields))
except (ValueError,OSError) as exc:return self.respond({'error':str(exc)},400)
if self.path == '/api/v1/conversion/start':
try:
from humaneness import read_upload as read_conversion_upload
ident,source,reference=read_conversion_upload(self)
return self.respond(self.server.humaneness.start(ident,source,reference))
except (OSError,ValueError,InferenceError) as exc:return self.respond({'error':str(exc)},400)
if self.path == '/api/v1/conversion/cancel':return self.respond(self.server.humaneness.stop() or {'ok':True})
if self.path in ('/api/v1/qwen-native/install','/api/v1/qwen-native/install-cancel','/api/v1/qwen-native/start','/api/v1/qwen-native/cancel'):
try:
if self.path.endswith('/start') and self.headers.get('Content-Type','').startswith('multipart/form-data'):