Spaces:
Running
on
Zero
Running
on
Zero
NikhilJoson
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -6,16 +6,17 @@ import random
|
|
6 |
import numpy as np
|
7 |
|
8 |
MARKDOWN = """
|
9 |
-
#
|
10 |
-
|
11 |
-
|
12 |
-
for taking it to the next level by enabling inpainting with the FLUX.
|
13 |
"""
|
14 |
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
DEVICE = "cuda" #if torch.cuda.is_available() else "cpu"
|
17 |
|
18 |
-
|
|
|
|
|
19 |
|
20 |
@spaces.GPU()
|
21 |
def process(input_image_editor, mask_image, input_text, strength, seed, randomize_seed, num_inference_steps, guidance_scale=3.5, progress=gr.Progress(track_tqdm=True)):
|
@@ -34,9 +35,9 @@ def process(input_image_editor, mask_image, input_text, strength, seed, randomiz
|
|
34 |
|
35 |
generator = torch.Generator(device=DEVICE).manual_seed(seed)
|
36 |
|
37 |
-
result =
|
38 |
-
|
39 |
-
|
40 |
|
41 |
return result, mask_image, seed
|
42 |
|
|
|
6 |
import numpy as np
|
7 |
|
8 |
MARKDOWN = """
|
9 |
+
# Prompt Canvas🎨
|
10 |
+
Thanks to [Black Forest Labs](https://huggingface.co/black-forest-labs) team for creating this amazing model,
|
11 |
+
and a big thanks to [Gothos](https://github.com/Gothos) for taking it to the next level by enabling inpainting with the FLUX.
|
|
|
12 |
"""
|
13 |
|
14 |
MAX_SEED = np.iinfo(np.int32).max
|
15 |
DEVICE = "cuda" #if torch.cuda.is_available() else "cpu"
|
16 |
|
17 |
+
inpaint_pipe = FluxInpaintPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to(DEVICE)
|
18 |
+
|
19 |
+
|
20 |
|
21 |
@spaces.GPU()
|
22 |
def process(input_image_editor, mask_image, input_text, strength, seed, randomize_seed, num_inference_steps, guidance_scale=3.5, progress=gr.Progress(track_tqdm=True)):
|
|
|
35 |
|
36 |
generator = torch.Generator(device=DEVICE).manual_seed(seed)
|
37 |
|
38 |
+
result = inpaint_pipe(prompt=input_text, image=image, mask_image=mask_image, width=width, height=height,
|
39 |
+
strength=strength, num_inference_steps=num_inference_steps, generator=generator,
|
40 |
+
guidance_scale=guidance_scale).images[0]
|
41 |
|
42 |
return result, mask_image, seed
|
43 |
|