roboflow / roboflow-python

The official Roboflow Python package. Manage your datasets, models, and deployments. Roboflow has everything you need to build a computer vision application.
https://docs.roboflow.com/python
Apache License 2.0
280 stars 72 forks source link

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

Open LinasKo opened 6 months ago

LinasKo commented 6 months ago

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'}