Skip to content

Commit

Permalink
Fixed readme
Browse files Browse the repository at this point in the history
  • Loading branch information
beveradb committed Jul 7, 2023
1 parent 913c4c0 commit 6aab6fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ audio-separator [audio_file] --model_name [model_name]
model_file_dir: (Optional) Directory to cache model files in. Default: /tmp/audio-separator-models/
output_dir: (Optional) The directory where the separated files will be saved. If not specified, outputs to current dir.
use_cuda: (Optional) Flag to use Nvidia GPU via CUDA for separation if available. Default: False
log_level: (Optional) The log level. Default: logging.DEBUG
log_level: (Optional) Logging level, e.g. info, debug, warning. Default: INFO
log_formatter: (Optional) The log format. Default: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
```
Expand Down Expand Up @@ -73,7 +73,7 @@ print(f'Secondary stem saved at {secondary_stem_path}')
- model_file_dir: (Optional) Directory to cache model files in. Default: /tmp/audio-separator-models/
- output_dir: (Optional) Directory where the separated files will be saved. If not specified, outputs to current dir.
- use_cuda: (Optional) Flag to use Nvidia GPU via CUDA for separation if available. Default: False
- log_level: (Optional) The log level. Default: logging.DEBUG
- log_level: (Optional) Logging level, e.g. info, debug, warning. Default: INFO
- log_formatter: (Optional) The log format. Default: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
## Requirements 📋
Expand Down
34 changes: 13 additions & 21 deletions audio_separator/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,34 @@
import pkg_resources
from audio_separator import Separator

LOG_LEVEL = logging.DEBUG


def main():
logger = logging.getLogger(__name__)
logger.setLevel(LOG_LEVEL)

log_handler = logging.StreamHandler()

log_formatter = logging.Formatter(fmt="%(asctime)s.%(msecs)03d - %(levelname)s - %(module)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
log_handler.setFormatter(log_formatter)
logger.addHandler(log_handler)

logger.debug("Parsing CLI args")
parser = argparse.ArgumentParser(
description="Separate audio file into different stems.",
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=35),
)

parser.add_argument("audio_file", nargs="?", help="The audio file path to separate, in any common format.", default=argparse.SUPPRESS)

parser = argparse.ArgumentParser(description="Separate audio file into different stems.")
package_version = pkg_resources.get_distribution("audio-separator").version
parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {package_version}")
parser.add_argument("--log_level", default="INFO", help="Optional: Logging level, e.g. info, debug, warning. Default: INFO")

parser.add_argument("audio_file", nargs="?", help="The audio file path to separate.", default=argparse.SUPPRESS)
parser.add_argument("--model_name", default="UVR_MDXNET_KARA_2", help="Optional: model name to be used for separation.")
parser.add_argument("--model_file_dir", default="/tmp/audio-separator-models/", help="Optional: model files directory.")

parser.add_argument("--output_dir", default=None, help="Optional: directory to write output files. Default: current dir.")
parser.add_argument("--use_cuda", action="store_true", help="Optional: use Nvidia GPU with CUDA for separation.")

parser.add_argument(
"--output_dir",
default=None,
help="Optional directory where the separated files will be saved. If not specified, outputs to current dir.",
)
parser.add_argument("--version", action="store_true", help="Show the version number and exit")

args = parser.parse_args()

if args.version:
version = pkg_resources.get_distribution("audio-separator").version
print(f"audio-separator version: {version}")
exit(0)
log_level = getattr(logging, args.log_level.upper())
logger.setLevel(log_level)

if not hasattr(args, "audio_file"):
parser.print_help()
Expand All @@ -54,7 +46,7 @@ def main():
output_dir=args.output_dir,
use_cuda=args.use_cuda,
log_formatter=log_formatter,
log_level=LOG_LEVEL,
log_level=log_level,
)
primary_stem_path, secondary_stem_path = separator.separate()

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "audio-separator"
version = "0.3.2"
version = "0.3.3"
description = "Easy to use vocal separation on CLI or as a python package, using the amazing MDX-Net models from UVR trained by @Anjok07"
authors = ["Andrew Beveridge <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 6aab6fe

Please sign in to comment.