Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import os
|
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
import torch
|
10 |
from diffusers import DiffusionPipeline
|
|
|
11 |
|
12 |
# Constants
|
13 |
MAX_SEED = np.iinfo(np.int32).max
|
@@ -18,6 +19,8 @@ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
18 |
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev",
|
19 |
custom_pipeline="pipeline_flux_rf_inversion",
|
20 |
torch_dtype=torch.bfloat16)
|
|
|
|
|
21 |
pipe.to(DEVICE)
|
22 |
|
23 |
def reset_do_inversion():
|
@@ -86,10 +89,11 @@ with gr.Blocks(css=css) as demo:
|
|
86 |
do_inversion = gr.State(False)
|
87 |
|
88 |
with gr.Column(elem_id="col-container"):
|
89 |
-
gr.Markdown(f"""# RF inversion
|
90 |
-
Edit real images with
|
|
|
91 |
Stochastic Rectified Differential Equations*](https://rf-inversion.github.io/data/rf-inversion.pdf)
|
92 |
-
[[non-commercial license](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)] [[project page](https://rf-inversion.github.io/
|
93 |
""")
|
94 |
|
95 |
with gr.Row():
|
@@ -132,8 +136,8 @@ Stochastic Rectified Differential Equations*](https://rf-inversion.github.io/dat
|
|
132 |
label="num inversion steps",
|
133 |
minimum=1,
|
134 |
maximum=50,
|
135 |
-
step=
|
136 |
-
value=
|
137 |
)
|
138 |
|
139 |
with gr.Row():
|
|
|
8 |
from huggingface_hub import hf_hub_download
|
9 |
import torch
|
10 |
from diffusers import DiffusionPipeline
|
11 |
+
from huggingface_hub import hf_hub_download
|
12 |
|
13 |
# Constants
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
19 |
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev",
|
20 |
custom_pipeline="pipeline_flux_rf_inversion",
|
21 |
torch_dtype=torch.bfloat16)
|
22 |
+
pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8steps-lora.safetensors"), lora_scale=0.125)
|
23 |
+
pipe.fuse_lora(lora_scale=0.125)
|
24 |
pipe.to(DEVICE)
|
25 |
|
26 |
def reset_do_inversion():
|
|
|
89 |
do_inversion = gr.State(False)
|
90 |
|
91 |
with gr.Column(elem_id="col-container"):
|
92 |
+
gr.Markdown(f"""# RF inversion 🖌️🏞️
|
93 |
+
### Edit real images with FLUX.1 [dev]
|
94 |
+
based on the algorithm proposed in [*Semantic Image Inversion and Editing using
|
95 |
Stochastic Rectified Differential Equations*](https://rf-inversion.github.io/data/rf-inversion.pdf)
|
96 |
+
[[non-commercial license](https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md)] [[project page](https://rf-inversion.github.io/) [[arxiv](https://arxiv.org/pdf/2410.10792)]
|
97 |
""")
|
98 |
|
99 |
with gr.Row():
|
|
|
136 |
label="num inversion steps",
|
137 |
minimum=1,
|
138 |
maximum=50,
|
139 |
+
step=1,
|
140 |
+
value=8,
|
141 |
)
|
142 |
|
143 |
with gr.Row():
|