roboflow-python icon indicating copy to clipboard operation
roboflow-python copied to clipboard

Clarity between `hosted_image` and `is_hosted` in `Project.upload`

Open LinasKo opened this issue 1 year ago • 0 comments

I find it confusing that in Project.upload there's both a hosted_image: boolargument set by the user, and an internal is_hosted, that determines which errors may be thrown.

By setting hosted_image it's possible to bypass checks and send the image to Roboflow, which promptly returns a 500 code.

Still, maybe there's a reason behind it?

Test code:

import roboflow

img_path = "<path_to_img>"
rf = roboflow.Roboflow(api_key="API_KEY")

workspace_id = "<ws ID>"
project_id = "<proj ID>"
workspace = rf.workspace(workspace_id)
project = workspace.project(project_id)

project.upload(img_path, hosted_image=True)

This raises:

File  ... /roboflow/adapters/rfapi.py:90, in upload_image(api_key, project_url, image_path, hosted_image, split, batch_name, tag_names, sequence_number, sequence_size, **kwargs)
UploadError: Bad response: 500: {'error': 'Unknown error'}

LinasKo avatar Feb 27 '24 19:02 LinasKo