From 996c69a1a891e81b24fde31e4cb5cb0b4de27faa Mon Sep 17 00:00:00 2001 From: MayDomine <1583143678@qq.com> Date: Fri, 19 Sep 2025 12:53:23 +0800 Subject: [PATCH] add prompt-file option to set prompt text --- src/voxcpm/cli.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/voxcpm/cli.py b/src/voxcpm/cli.py index 801266f..f58e8b1 100644 --- a/src/voxcpm/cli.py +++ b/src/voxcpm/cli.py @@ -240,6 +240,7 @@ Examples: # Prompt audio (for voice cloning) parser.add_argument("--prompt-audio", "-pa", help="Reference audio file path") parser.add_argument("--prompt-text", "-pt", help="Reference text corresponding to the audio") + parser.add_argument("--prompt-file", "-pf", help="Reference text file corresponding to the audio") parser.add_argument("--denoise", action="store_true", help="Enable prompt speech enhancement (denoising)") # Generation parameters @@ -279,6 +280,12 @@ def main(): # If prompt audio+text provided → voice cloning if args.prompt_audio or args.prompt_text: + if not args.prompt_text and args.prompt_file: + assert os.path.isfile(args.prompt_file), "Prompt file does not exist or is not accessible." + + with open(args.prompt_file, 'r', encoding='utf-8') as f: + args.prompt_text = f.read() + if not args.prompt_audio or not args.prompt_text: print("Error: Voice cloning requires both --prompt-audio and --prompt-text") sys.exit(1)