Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions roboflow/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def project(self, project_id):
if self.__api_key in DEMO_KEYS:
return Project(self.__api_key, {}, self.model_format)

# project_id = project_id.replace(self.url + "/", "")
if not project_id:
raise RuntimeError("Project id is required but none was specified.")

if "/" in project_id:
raise RuntimeError(f"The {project_id} project is not available in this ({self.url}) workspace")
raise RuntimeError(f"{project_id=} cannot contain a '/', use workspace argument to change the URL.")

dataset_info = rfapi.get_project(self.__api_key, self.url, project_id)
dataset_info = dataset_info["project"]
Expand Down
30 changes: 17 additions & 13 deletions roboflow/roboflowpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,18 @@ def upload_image(args):
rf = roboflow.Roboflow()
workspace = rf.workspace(args.workspace)
project = workspace.project(args.project)
project.single_upload(
image_path=args.imagefile,
annotation_path=args.annotation,
annotation_labelmap=args.labelmap,
split=args.split,
num_retry_uploads=args.num_retries,
batch_name=args.batch,
tag_names=args.tag_names.split(",") if args.tag_names else [],
is_prediction=args.is_prediction,
)
tag_names = args.tag_names.split(",") if args.tag_names else []
for image_path in args.imagefile:
project.single_upload(
image_path=image_path,
annotation_path=args.annotation,
annotation_labelmap=args.labelmap,
split=args.split,
num_retry_uploads=args.num_retries,
batch_name=args.batch,
tag_names=tag_names,
is_prediction=args.is_prediction,
)


def upload_model(args):
Expand Down Expand Up @@ -263,10 +265,11 @@ def _add_download_parser(subparsers):


def _add_upload_parser(subparsers):
upload_parser = subparsers.add_parser("upload", help="Upload a single image to a dataset")
upload_parser = subparsers.add_parser("upload", help="Upload one or more images to a dataset")
upload_parser.add_argument(
"imagefile",
help="path to image file",
nargs="+",
help="path to one or more image files to upload",
)
upload_parser.add_argument(
"-w",
Expand All @@ -276,7 +279,8 @@ def _add_upload_parser(subparsers):
upload_parser.add_argument(
"-p",
dest="project",
help="project_id to upload the image into",
required=True,
help="project_id to upload the image into (required)",
)
upload_parser.add_argument(
"-a",
Expand Down