mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
fix(vall-e-x): Fix voice cloning (#1696)
This commit is contained in:
parent
58cdf97361
commit
fd68bf7084
2 changed files with 7 additions and 3 deletions
|
@ -55,6 +55,7 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||
print("Preparing models, please wait", file=sys.stderr)
|
||||
# download and load all models
|
||||
preload_models()
|
||||
self.clonedVoice = False
|
||||
# Assume directory from request.ModelFile.
|
||||
# Only if request.LoraAdapter it's not an absolute path
|
||||
if request.AudioPath and request.ModelFile != "" and not os.path.isabs(request.AudioPath):
|
||||
|
@ -65,6 +66,7 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||
if request.AudioPath != "":
|
||||
print("Generating model", file=sys.stderr)
|
||||
make_prompt(name=model_name, audio_prompt_path=request.AudioPath)
|
||||
self.clonedVoice = True
|
||||
### Use given transcript
|
||||
##make_prompt(name=model_name, audio_prompt_path="paimon_prompt.wav",
|
||||
## transcript="Just, what was that? Paimon thought we were gonna get eaten.")
|
||||
|
@ -91,6 +93,8 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
|
|||
try:
|
||||
audio_array = None
|
||||
if model != "":
|
||||
if self.clonedVoice:
|
||||
model = os.path.basename(request.model)
|
||||
audio_array = generate_audio(request.text, prompt=model)
|
||||
else:
|
||||
audio_array = generate_audio(request.text)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue