Skip to content

Conversation

hisushanta
Copy link
Contributor

The elegance of this image binarization code lies in its simplicity. With just a single line, it leverages the PIL.Image.point() method to threshold the image into black and white. Free of complexity and verbose syntax, this solution gets straight to the point - converting pixel values to binary based on a set threshold.

Before submitting

Who can review?

@sayakpaul @patrickvonplaten @yiyixuxu

hisushanta and others added 30 commits October 5, 2023 06:34
…standing other developers what are doing and where it's using.
This changes suggest by maintener.

Co-authored-by: Sayak Paul <[email protected]>
Add suggested text

Co-authored-by: Sayak Paul <[email protected]>
I changed the Parameter to Args text.
proper indentation set in this file.
a little bit of change in the act_fun argument line.
similar doc-string add to have in the original diffusion repository.
List[np.ndarray],
List[torch.FloatTensor],
]
PipelineDepthInput = PipelineImageInput
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you.

image = image.convert("RGB")

return image
return image.convert("RGB")
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes the code harder to debug with pdb or ipdb - do we really need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! Your suggestions were invaluable, and I've gladly returned to the original version. Thank you for guiding me towards the best outcome.

Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

@hisushanta
Copy link
Contributor Author

I recognized the value in those two crucial lines, so I carefully preserved them while reverting to other changes.

@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.

@sayakpaul sayakpaul merged commit 2993257 into huggingface:main Jan 4, 2024
@hisushanta hisushanta deleted the bug_fix branch January 5, 2024 01:16
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* I added a new doc string to the class. This is more flexible to understanding other developers what are doing and where it's using.

* Update src/diffusers/models/unet_2d_blocks.py

This changes suggest by maintener.

Co-authored-by: Sayak Paul <[email protected]>

* Update src/diffusers/models/unet_2d_blocks.py

Add suggested text

Co-authored-by: Sayak Paul <[email protected]>

* Update unet_2d_blocks.py

I changed the Parameter to Args text.

* Update unet_2d_blocks.py

proper indentation set in this file.

* Update unet_2d_blocks.py

a little bit of change in the act_fun argument line.

* I run the black command to reformat style in the code

* Update unet_2d_blocks.py

similar doc-string add to have in the original diffusion repository.

* Batter way to write binarize function

* Solve check_code_quality error

* My mistake to run pull request but not reformated file

* Update image_processor.py

* remove extra variable and space

* Update image_processor.py

* Run ruff libarary to reformat my file

---------

Co-authored-by: Sayak Paul <[email protected]>
Co-authored-by: YiYi Xu <[email protected]>
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.

5 participants