This commit is contained in:
wataru 2022-11-03 04:23:04 +09:00
parent c1b05fa212
commit 5ea920433e
2 changed files with 14 additions and 14 deletions

View File

@ -22,7 +22,7 @@ import numpy as np
from mods.ssl import create_self_signed_cert from mods.ssl import create_self_signed_cert
from mods.VoiceChanger import VoiceChanger from mods.VoiceChanger import VoiceChanger
from mods.Whisper import Whisper # from mods.Whisper import Whisper
class UvicornSuppressFilter(logging.Filter): class UvicornSuppressFilter(logging.Filter):
def filter(self, record): def filter(self, record):
@ -54,22 +54,22 @@ class MyCustomNamespace(socketio.AsyncNamespace):
self.voiceChanger.destroy() self.voiceChanger.destroy()
self.voiceChanger = VoiceChanger(config, model) self.voiceChanger = VoiceChanger(config, model)
def loadWhisperModel(self, model): # def loadWhisperModel(self, model):
self.whisper = Whisper() # self.whisper = Whisper()
self.whisper.loadModel("tiny") # self.whisper.loadModel("tiny")
print("load") # print("load")
def changeVoice(self, gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData): def changeVoice(self, gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData):
if hasattr(self, 'whisper') == True: # if hasattr(self, 'whisper') == True:
self.whisper.addData(unpackedData) # self.whisper.addData(unpackedData)
return self.voiceChanger.on_request(gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData) return self.voiceChanger.on_request(gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData)
def transcribe(self): # def transcribe(self):
if hasattr(self, 'whisper') == True: # if hasattr(self, 'whisper') == True:
self.whisper.transcribe(0) # self.whisper.transcribe(0)
else: # else:
print("whisper not found") # print("whisper not found")
def on_connect(self, sid, environ): def on_connect(self, sid, environ):
@ -154,7 +154,7 @@ if __name__ == thisFilename or args.colab == True:
sio.register_namespace(namespace) sio.register_namespace(namespace)
if CONFIG and MODEL: if CONFIG and MODEL:
namespace.loadModel(CONFIG, MODEL) namespace.loadModel(CONFIG, MODEL)
namespace.loadWhisperModel("base") # namespace.loadWhisperModel("base")
app_socketio = socketio.ASGIApp( app_socketio = socketio.ASGIApp(

View File

@ -1,4 +1,4 @@
FROM dannadori/voice-changer-internal:20221103_035426 as front FROM dannadori/voice-changer-internal:20221103_041401 as front
FROM debian:bullseye-slim as base FROM debian:bullseye-slim as base
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive