Skip to content

Conversation

@ovalle15
Copy link
Contributor

No description provided.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@paulnoirel
Copy link
Contributor

paulnoirel commented Feb 28, 2024

Good job @ovalle15 !

I would suggest putting the following in a different cell so we can have the example with imBytes and the one with instanceURI:

#Using bytes array.
response = requests.get(cp_mask_url)
im_bytes = base64.b64encode(response.content).decode('utf-8')
for color in colors:
  if color in rgb_colors_for_mask_with_text_subclass_tool:
    cp_mask_ndjson.append({
      "name": "mask_with_text_subclass",
      "mask": {"imBytes": im_bytes, 
      "colorRGB": color },
      "classifications":[{
        "name": "sub_free_text",
        "answer": "free text answer"
      }]
    }
  )
  else:
    cp_mask_ndjson.append({
          "name": "mask",
          "classifications": [],
          "mask": {
            "imBytes": im_bytes,
            "colorRGB": color
      }
    }
  )
#Using mask URL (raw_url)
response = requests.get(cp_mask_url)
im_bytes = base64.b64encode(response.content).decode('utf-8')
for color in colors:
  if color in rgb_colors_for_mask_with_text_subclass_tool:
    cp_mask_ndjson.append({
      "name": "mask_with_text_subclass",
      "mask": {"instanceURI": raw_url, # You can also use instanceURI and pass the raw URL
      "colorRGB": color },
      "classifications":[{
        "name": "sub_free_text",
        "answer": "free text answer"
      }]
    }
  )
  else:
    cp_mask_ndjson.append({
          "name": "mask",
          "classifications": [],
          "mask": {
            "instanceURI": raw_url,
            "colorRGB": color
      }
    }
  )

@paulnoirel paulnoirel self-requested a review February 28, 2024 17:01
Copy link
Contributor

@paulnoirel paulnoirel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ovalle15 ovalle15 merged commit 70673af into develop Feb 28, 2024
@ovalle15 ovalle15 deleted the ao_fixes_masks branch February 28, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants