Akjava commited on
Commit
bde9fae
1 Parent(s): 6453bed
Files changed (2) hide show
  1. demo_header.html +3 -4
  2. flux1_img2img.py +4 -3
demo_header.html CHANGED
@@ -1,13 +1,12 @@
1
  <div style="text-align: center;">
2
  <h1>
3
- Flux.1-schnell mask-inpaint
4
  </h1>
5
  <p>Making face images for <a href="https://huggingface.co/spaces/Akjava/godot-huggingface-chain">AI Diagram Chat with Voice/Face Character</a></p>
6
  <p>
7
 
8
  See examples.
9
- The image requires guide painting.(To generate an image with closed eyes, fill the eye area with skin color.)
10
- You can draw mask or upload mask.BE CAREFUL UPLOAEDED MASK(If the uploaded mask exist,ignore your painted mask)
11
  </p>
12
- <p>Hint:step by step,reduce strength.blur guide-paint and mask</p>
13
  </div>
 
1
  <div style="text-align: center;">
2
  <h1>
3
+ Flux.1-schnell mask-img2img
4
  </h1>
5
  <p>Making face images for <a href="https://huggingface.co/spaces/Akjava/godot-huggingface-chain">AI Diagram Chat with Voice/Face Character</a></p>
6
  <p>
7
 
8
  See examples.
9
+
 
10
  </p>
11
+ <p>Hint:</p>
12
  </div>
flux1_img2img.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- from diffusers import FluxInpaintPipeline
3
 
4
  from PIL import Image
5
  import sys
@@ -12,15 +12,16 @@ def process_image(image,mask_image,prompt="a person",model_id="black-forest-labs
12
  if image == None:
13
  return None
14
 
15
- pipe = FluxInpaintPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
16
  pipe.to("cuda")
17
 
18
  generators = []
19
  generator = torch.Generator("cuda").manual_seed(seed)
20
  generators.append(generator)
21
  # more parameter see https://huggingface.co/docs/diffusers/api/pipelines/flux#diffusers.FluxInpaintPipeline
22
- output = pipe(prompt=prompt, image=image, mask_image=mask_image,generator=generator,strength=strength)
23
 
 
24
  return output.images[0]
25
 
26
  if __name__ == "__main__":
 
1
  import torch
2
+ from diffusers import FluxImg2ImgPipeline
3
 
4
  from PIL import Image
5
  import sys
 
12
  if image == None:
13
  return None
14
 
15
+ pipe = FluxImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
16
  pipe.to("cuda")
17
 
18
  generators = []
19
  generator = torch.Generator("cuda").manual_seed(seed)
20
  generators.append(generator)
21
  # more parameter see https://huggingface.co/docs/diffusers/api/pipelines/flux#diffusers.FluxInpaintPipeline
22
+ output = pipe(prompt=prompt, image=image,generator=generator,strength=strength)
23
 
24
+ # TODO support mask
25
  return output.images[0]
26
 
27
  if __name__ == "__main__":