Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use comma separated texts to represent query #4

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions labelme_toolkit/_cli/_ai_annotate_rectangles.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def _ai_annotate_rectangles(
logger.info(f"{image_file!r} - Saved to {output_image_file!r}")


def _comma_separated_text(value: str) -> List[str]:
return value.split(",")


@click.command()
@click.argument("file_or_dir", type=click.Path(exists=True), required=True)
@click.option(
Expand All @@ -86,9 +90,8 @@ def _ai_annotate_rectangles(
)
@click.option(
"--texts",
multiple=True,
type=str,
help="Texts to annotate.",
type=_comma_separated_text,
help="Comma separated texts to annotate (e.g., 'dog,cat').",
required=True,
)
@click.option(
Expand Down Expand Up @@ -120,8 +123,8 @@ def ai_annotate_rectangles(file_or_dir: str, **kwargs) -> None:
Examples:

\b
$ labelmetk ai-annotate-rectangles examples/small_dataset/2011_000003.json --texts person
$ labelmetk ai-annotate-rectangles examples/small_dataset/ --texts person
$ labelmetk ai-annotate-rectangles examples/small_dataset/2011_000003.jpg --texts person,hat
$ labelmetk ai-annotate-rectangles examples/small_dataset/ --texts person,hat

""" # noqa: E501
image_files: List[str]
Expand Down
Loading