mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-03-12 19:07:49 +03:00
Some small modifications
This commit is contained in:
parent
3726a926b7
commit
6f1b06a419
@ -5,34 +5,36 @@ from voice_changer.VoiceChangerManager import VoiceChangerManager
|
|||||||
from const import getFrontendPath
|
from const import getFrontendPath
|
||||||
|
|
||||||
|
|
||||||
class MMVC_SocketIOApp():
|
class MMVC_SocketIOApp:
|
||||||
|
_instance: socketio.ASGIApp | None = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_instance(cls, app_fastapi, voiceChangerManager: VoiceChangerManager):
|
def get_instance(cls, app_fastapi, voiceChangerManager: VoiceChangerManager):
|
||||||
if not hasattr(cls, "_instance"):
|
if cls._instance is None:
|
||||||
sio = MMVC_SocketIOServer.get_instance(voiceChangerManager)
|
sio = MMVC_SocketIOServer.get_instance(voiceChangerManager)
|
||||||
app_socketio = socketio.ASGIApp(
|
app_socketio = socketio.ASGIApp(
|
||||||
sio,
|
sio,
|
||||||
other_asgi_app=app_fastapi,
|
other_asgi_app=app_fastapi,
|
||||||
static_files={
|
static_files={
|
||||||
'/assets/icons/github.svg': {
|
"/assets/icons/github.svg": {
|
||||||
'filename': f'{getFrontendPath()}/assets/icons/github.svg',
|
"filename": f"{getFrontendPath()}/assets/icons/github.svg",
|
||||||
'content_type': 'image/svg+xml'
|
"content_type": "image/svg+xml",
|
||||||
},
|
},
|
||||||
'/assets/icons/help-circle.svg': {
|
"/assets/icons/help-circle.svg": {
|
||||||
'filename': f'{getFrontendPath()}/assets/icons/help-circle.svg',
|
"filename": f"{getFrontendPath()}/assets/icons/help-circle.svg",
|
||||||
'content_type': 'image/svg+xml'
|
"content_type": "image/svg+xml",
|
||||||
},
|
},
|
||||||
'/assets/icons/tool.svg': {
|
"/assets/icons/tool.svg": {
|
||||||
'filename': f'{getFrontendPath()}/assets/icons/tool.svg',
|
"filename": f"{getFrontendPath()}/assets/icons/tool.svg",
|
||||||
'content_type': 'image/svg+xml'
|
"content_type": "image/svg+xml",
|
||||||
},
|
},
|
||||||
'/buymeacoffee.png': {
|
"/buymeacoffee.png": {
|
||||||
'filename': f'{getFrontendPath()}/assets/buymeacoffee.png',
|
"filename": f"{getFrontendPath()}/assets/buymeacoffee.png",
|
||||||
'content_type': 'image/png'
|
"content_type": "image/png",
|
||||||
|
},
|
||||||
|
"": f"{getFrontendPath()}",
|
||||||
|
"/": f"{getFrontendPath()}/index.html",
|
||||||
},
|
},
|
||||||
'': f'{getFrontendPath()}',
|
|
||||||
'/': f'{getFrontendPath()}/index.html',
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cls._instance = app_socketio
|
cls._instance = app_socketio
|
||||||
|
@ -3,18 +3,17 @@ import socketio
|
|||||||
from sio.MMVC_Namespace import MMVC_Namespace
|
from sio.MMVC_Namespace import MMVC_Namespace
|
||||||
from voice_changer.VoiceChangerManager import VoiceChangerManager
|
from voice_changer.VoiceChangerManager import VoiceChangerManager
|
||||||
|
|
||||||
class MMVC_SocketIOServer():
|
|
||||||
|
class MMVC_SocketIOServer:
|
||||||
|
_instance: socketio.AsyncServer | None = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_instance(cls, voiceChangerManager:VoiceChangerManager):
|
def get_instance(cls, voiceChangerManager: VoiceChangerManager):
|
||||||
if not hasattr(cls, "_instance"):
|
if not hasattr(cls, "_instance"):
|
||||||
sio = socketio.AsyncServer(
|
sio = socketio.AsyncServer(async_mode="asgi", cors_allowed_origins="*")
|
||||||
async_mode='asgi',
|
|
||||||
cors_allowed_origins='*'
|
|
||||||
)
|
|
||||||
namespace = MMVC_Namespace.get_instance(voiceChangerManager)
|
namespace = MMVC_Namespace.get_instance(voiceChangerManager)
|
||||||
sio.register_namespace(namespace)
|
sio.register_namespace(namespace)
|
||||||
cls._instance = sio
|
cls._instance = sio
|
||||||
return cls._instance
|
return cls._instance
|
||||||
|
|
||||||
return cls._instance
|
return cls._instance
|
||||||
|
|
||||||
|
@ -325,9 +325,6 @@ class RVC:
|
|||||||
dev = self.deviceManager.getDevice(self.settings.gpu)
|
dev = self.deviceManager.getDevice(self.settings.gpu)
|
||||||
half = self.deviceManager.halfPrecisionAvailable(self.settings.gpu)
|
half = self.deviceManager.halfPrecisionAvailable(self.settings.gpu)
|
||||||
|
|
||||||
# self.embedder = self.embedder.setDevice(dev)
|
|
||||||
# self.inferencer = self.inferencer.setDevice(dev)
|
|
||||||
|
|
||||||
audio = data[0]
|
audio = data[0]
|
||||||
convertSize = data[1]
|
convertSize = data[1]
|
||||||
vol = data[2]
|
vol = data[2]
|
||||||
@ -365,11 +362,6 @@ class RVC:
|
|||||||
|
|
||||||
result = audio_out * np.sqrt(vol)
|
result = audio_out * np.sqrt(vol)
|
||||||
|
|
||||||
# if self.settings.framework == "ONNX":
|
|
||||||
# audio = self._onnx_inference(data)
|
|
||||||
# else:
|
|
||||||
# audio = self._pyTorch_inference(data)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user