Skip to content

Conversation

@BritishWerewolf
Copy link
Contributor

A simple PR that allows the read method to convert from any supported type.

This will be useful for the pipeline API which uses the RawImage.read method call under the hood.
Currently read just interprets URLs, but this will allow File Uploads for instance.

// File upload
const file = event.target.files[0];
const image = await RawImage.read(file);

// Canvas
const canvas = document.querySelector('canvas');
const image = await RawImage.read(canvas);

This will be useful for the pipeline API.
Copy link
Collaborator

@xenova xenova left a comment

Choose a reason for hiding this comment

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

This is pretty useful, and is actually an update I wanted to make for a long time! Thanks! Can you also make sure the relevant pipelines also expose that blobs and canvas elements are now supported?

Update types for Background Removal pipeline to use same options as Image Segmentation Pipeline.
@BritishWerewolf BritishWerewolf requested a review from xenova March 20, 2025 07:34
Copy link
Collaborator

@xenova xenova left a comment

Choose a reason for hiding this comment

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

Thanks!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@xenova xenova merged commit 10b9349 into huggingface:main Mar 25, 2025
4 checks passed
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