README.md
April 26, 2025 ยท View on GitHub
๐๏ธ UniEdit-Flow_FLUX
The implementation of UniEdit-Flow based on official FLUX repository.
๐ ๏ธ Environment
The environment of our code is the same as FLUX and FireFlow, you can refer to the official FLUX repository for more details. You can run the following command to build the environment:
conda create -n unieditflow python==3.10
conda activate unieditflow
cd YOUR_WORKSPACE/UniEdit-Flow/UniEdit-Flow_FLUX
pip install -e ".[all]"
๐งช Examples
You can run the following ๐ป commands to perform image inversion and reconstruction or image editing:
cd YOUR_WORKSPACE/UniEdit-Flow/UniEdit-Flow_FLUX/src
# ๐ผ๏ธ Image Inversion and Reconstruction
# Null text of source_prompt and target_prompt is used for unconditional inversion and reconstruction, image description of source_prompt and target_prompt is used for conditional inversion and reconstruction.
python edit.py --source_prompt [image description or null text] \
--target_prompt [image description or null text] \
--source_img_dir [your image path] \
--output_dir [folder you want to save the results]
--sampling_strategy 'uniinv' \
--output_prefix 'uniinv' \
--num_steps 30 \
--alpha 1 \
--omega 0 \
--name 'flux-dev' \
--guidance 1 \
--inject 0 \
--start_layer_index 0 \
--end_layer_index 0
# ๐จ Image Editing
# We recommend alpha={0.6, 0.7, 0.75, 0.8}, omega=5.0, step={8, 10, 12, 15, 20, 30}.
# guidance could be {1.0, 1.5, 2.0}, inject, start_layer_index, and end_layer_index should be 0 for Uni-Edit.
python edit.py --source_prompt [image description] \
--target_prompt [description of your editing target] \
--source_img_dir [your image path] \
--output_dir [folder you want to save the results]
--sampling_strategy 'uniedit' \
--output_prefix 'uniedit' \
--num_steps 15 \
--alpha 0.6 \
--omega 5.0 \
--name 'flux-dev' \
--guidance 1 \
--inject 0 \
--start_layer_index 0 \
--end_layer_index 0
๐ก Gradio GUI
You can also use the gradio GUI for easy image editing by running the following ๐ป command:
python gradio_demo.py
Here we have provided some examples for users to have a fast test. There is a preview of the ๐ก GUI: