Skip to content

flux.2-dev-edit#1369

Merged
Artiprocher merged 6 commits intomodelscope:mainfrom
lzws:main
Mar 24, 2026
Merged

flux.2-dev-edit#1369
Artiprocher merged 6 commits intomodelscope:mainfrom
lzws:main

Conversation

@lzws
Copy link
Copy Markdown
Collaborator

@lzws lzws commented Mar 24, 2026

flux.2-dev-edit

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Flux2 image pipeline examples by introducing image-to-image editing functionality. The updated scripts now showcase how an initial generated image can be further transformed based on a new textual prompt, demonstrating a more advanced use case for the pipeline.

Highlights

  • Image-to-Image Editing Example: Added new code examples demonstrating image-to-image transformation capabilities within the Flux2 pipeline, utilizing the edit_image parameter.
  • PIL Library Integration: Included the PIL.Image library to facilitate loading and processing of images for the new editing functionality.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds an image editing step to two example scripts for FLUX.2-dev. While the changes are functional, they can be improved for readability and maintainability. My review provides suggestions to use more descriptive variable names, handle file opening safely, and reduce hardcoded values. These improvements will make the example scripts clearer and more robust.

Comment on lines +29 to +32
prompt = "Transform the image into Japanese anime style"
edit_image = [Image.open("image_FLUX.2-dev.jpg")]
image = pipe(prompt, seed=42, rand_device="cuda", edit_image=edit_image, num_inference_steps=50, embedded_guidance=2.5)
image.save("image_FLUX.2-dev-1.jpg") No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This block of code for image editing can be improved for clarity and robustness.

  • Variable Naming: Variables prompt and image are overwritten. Using new, descriptive names like edit_prompt and edited_image would make the script's flow easier to follow.
  • File Handling: It's a good practice to use a with statement when opening files. This ensures that the file is closed automatically, even if errors occur.
  • Hardcoded Filename: The filename "image_FLUX.2-dev.jpg" is hardcoded here and also on line 27. It's better to define it in a variable to avoid duplication and potential typos.
  • Style: There's an extra space in the assignment on line 29.
Suggested change
prompt = "Transform the image into Japanese anime style"
edit_image = [Image.open("image_FLUX.2-dev.jpg")]
image = pipe(prompt, seed=42, rand_device="cuda", edit_image=edit_image, num_inference_steps=50, embedded_guidance=2.5)
image.save("image_FLUX.2-dev-1.jpg")
edit_prompt = "Transform the image into Japanese anime style"
input_image_filename = "image_FLUX.2-dev.jpg"
with Image.open(input_image_filename) as img_to_edit:
input_for_edit = [img_to_edit]
edited_image = pipe(edit_prompt, seed=42, rand_device="cuda", edit_image=input_for_edit, num_inference_steps=50, embedded_guidance=2.5)
edited_image.save("image_FLUX.2-dev-1.jpg")

Comment on lines +30 to +33
prompt = "Transform the image into Japanese anime style"
edit_image = [Image.open("image.jpg")]
image = pipe(prompt, seed=42, rand_device="cuda", edit_image=edit_image, num_inference_steps=50, embedded_guidance=2.5)
image.save("image-1.jpg") No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This block of code for image editing can be improved for clarity and robustness.

  • Variable Naming: Variables prompt and image are overwritten. Using new, descriptive names like edit_prompt and edited_image would make the script's flow easier to follow.
  • File Handling: It's a good practice to use a with statement when opening files. This ensures that the file is closed automatically, even if errors occur.
  • Hardcoded Filename: The filename "image.jpg" is hardcoded here and also on line 28. It's better to define it in a variable to avoid duplication and potential typos.
  • Style: There's an extra space in the assignment on line 30.
Suggested change
prompt = "Transform the image into Japanese anime style"
edit_image = [Image.open("image.jpg")]
image = pipe(prompt, seed=42, rand_device="cuda", edit_image=edit_image, num_inference_steps=50, embedded_guidance=2.5)
image.save("image-1.jpg")
edit_prompt = "Transform the image into Japanese anime style"
input_image_filename = "image.jpg"
with Image.open(input_image_filename) as img_to_edit:
input_for_edit = [img_to_edit]
edited_image = pipe(edit_prompt, seed=42, rand_device="cuda", edit_image=input_for_edit, num_inference_steps=50, embedded_guidance=2.5)
edited_image.save("image-1.jpg")

@Artiprocher Artiprocher merged commit 5e7e3db into modelscope:main Mar 24, 2026
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.

2 participants