This commit is contained in:
wataru 2022-11-04 03:20:43 +09:00
parent 0a5c8e57cb
commit 6b32d3b50b
4 changed files with 10 additions and 6 deletions

View File

@ -62,8 +62,12 @@ class MyCustomNamespace(socketio.AsyncNamespace):
def changeVoice(self, gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData):
# if hasattr(self, 'whisper') == True:
# self.whisper.addData(unpackedData)
if hasattr(self, 'voiceChanger') == True:
return self.voiceChanger.on_request(gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData)
else:
print("Voice Change is not loaded. Did you load a correct model?")
return np.zeros(1).astype(np.int16)
# def transcribe(self):
# if hasattr(self, 'whisper') == True:
@ -89,7 +93,6 @@ class MyCustomNamespace(socketio.AsyncNamespace):
audio1 = self.changeVoice(gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData)
bin = struct.pack('<%sh'%len(audio1), *audio1)
await self.emit('response',[timestamp, bin])
def on_disconnect(self, sid):
@ -260,8 +263,8 @@ if __name__ == thisFilename or args.colab == True:
write("logs/received_data.wav", 24000, unpackedData.astype(np.int16))
changedVoice = namespace.changeVoice(gpu, srcId, dstId, timestamp, prefixChunkSize, unpackedData)
changedVoiceBase64 = base64.b64encode(changedVoice).decode('utf-8')
changedVoiceBase64 = base64.b64encode(changedVoice).decode('utf-8')
data = {
"gpu":gpu,
"srcId":srcId,
@ -274,6 +277,7 @@ if __name__ == thisFilename or args.colab == True:
json_compatible_item_data = jsonable_encoder(data)
return JSONResponse(content=json_compatible_item_data)
except Exception as e:
print("REQUEST PROCESSING!!!! EXCEPTION!!!", e)
print(traceback.format_exc())

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -eu
DOCKER_IMAGE=dannadori/voice-changer:20221104_021706
DOCKER_IMAGE=dannadori/voice-changer:20221104_031752
#DOCKER_IMAGE=voice-changer

View File

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