-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
img2img added + update input descriptions #23
Conversation
All the code is from here https://github.com/Gothos/diffusers/tree/flux-inpaint/src/diffusers/pipelines/flux Gothos actually works at fal this is the img2img source code https://github.com/Gothos/diffusers/blob/flux-inpaint/src/diffusers/pipelines/flux/pipeline_flux_img2img.py |
predict.py
Outdated
) | ||
# Override width and height | ||
width, height = resized_width, resized_height | ||
flux_kwargs["image"] = input_image.resize((width, height), Image.LANCZOS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resizing creates artifacts, could we crop to the nearest smaller multiple of 16 instead?
- Crop images for img2img and inpaint modes (from center) - Make dimensions multiples of 16 (round down) - Avoid resizing artifacts
@zsxkib |
Hey @mountainguan, thanks for bringing this up. What you're seeing is likely due to our safety checker kicking in. You can actually bypass this when using the API by setting Just a heads up though - this safety feature can't be turned off on the website version. If you're curious about how we handle platform safety, check out our docs: Replicate's approach to safety Let me know if you need any more details! |
TLDR: Added image-to-image (img2img) functionality.
• Created img2img pipelines for dev and schnell models
• Integrated img2img into the predict method
• Added logic to detect img2img mode from inputs
• Improved handling of input images and masks for inpainting
• Adjusted image resizing for inpainting
• Updated input descriptions for width, height, and aspect ratio
• Added explanations for when inputs are ignored
• Allowed input images to override aspect ratio and dimensions
• Kept compatibility with existing txt2img feature
• Reused pipeline components to reduce memory use