From 12a49484258c5ddb8c99fa15fe527c4d01ae5989 Mon Sep 17 00:00:00 2001 From: Ayo Date: Thu, 4 Sep 2025 10:37:45 +0200 Subject: [PATCH] feat: implement shorter args --- README.md | 9 +++++++++ tts.py | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3928702..4a25f3b 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,9 @@ To run the program with an input file, use flag `--input_file`. ```bash $ python tts.py --input_file demo/tongue-twister.txt + +# or shorter... +$ python tts.py -i demo/tongue-twister.txt ``` ### Voices @@ -92,6 +95,9 @@ Optionally, you can indicate a voice you want to use with the `--voice` flag. Se ```bash $ python tts.py --voice am_michael + +# or shorter... +$ python tts.py -v am_michael ``` There are four shortcuts available to the best voices: `pro`, `hot`, `asmr`, `brit` (i.e., best trained voices), and `pro` is the default if no value is given @@ -113,6 +119,9 @@ You can disable the built-in audio player with `--skip_play` if you choose to pl ```bash $ python tts.py "Hello there!" --voice asmr --skip_play +# or shorter... +$ python tts.py "Hello there!" --voice asmr -s + ``` ## Demo Outputs diff --git a/tts.py b/tts.py index d8afe45..58fdea4 100644 --- a/tts.py +++ b/tts.py @@ -21,7 +21,7 @@ voices = { } def parse_args(): - parser = argparse.ArgumentParser(description="Simple TTS") + parser = argparse.ArgumentParser(description="Simple TTS", allow_abbrev=False) parser.add_argument( "input_text", type=str, @@ -31,6 +31,7 @@ def parse_args(): ) parser.add_argument( "--voice", + "-v", required=False, type=str, default="pro", @@ -38,6 +39,7 @@ def parse_args(): ) parser.add_argument( "--input_file", + "-i", required=False, type=str, default="demo/tongue-twister.txt", @@ -45,6 +47,7 @@ def parse_args(): ) parser.add_argument( "--device", + "-d", required=False, type=str, default=("cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else ("xpu" if torch.xpu.is_available() else "cpu"))), @@ -52,6 +55,7 @@ def parse_args(): ) parser.add_argument( "--skip_play", + "-s", required=False, action="store_true", help="Prevent playing the generated audio",