Upload 12 files
Browse files- .gitattributes +8 -0
- demo_footer.html +3 -0
- demo_header.html +16 -0
- demo_tools.html +10 -0
- examples/draw-gimp_input.jpg +3 -0
- examples/draw-gimp_output.jpg +3 -0
- examples/draw_input.jpg +3 -0
- examples/draw_output.jpg +3 -0
- examples/gimp_input.jpg +3 -0
- examples/gimp_output.jpg +3 -0
- examples/inpaint_input.jpg +3 -0
- examples/inpaint_output.jpg +3 -0
- flux1_img2img.py +36 -0
.gitattributes
CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
examples/draw_input.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
examples/draw_output.jpg filter=lfs diff=lfs merge=lfs -text
|
38 |
+
examples/draw-gimp_input.jpg filter=lfs diff=lfs merge=lfs -text
|
39 |
+
examples/draw-gimp_output.jpg filter=lfs diff=lfs merge=lfs -text
|
40 |
+
examples/gimp_input.jpg filter=lfs diff=lfs merge=lfs -text
|
41 |
+
examples/gimp_output.jpg filter=lfs diff=lfs merge=lfs -text
|
42 |
+
examples/inpaint_input.jpg filter=lfs diff=lfs merge=lfs -text
|
43 |
+
examples/inpaint_output.jpg filter=lfs diff=lfs merge=lfs -text
|
demo_footer.html
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<P> Images are generated with <a href="https://huggingface.co/black-forest-labs/FLUX.1-schnell">FLUX.1-schnell</a> and licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">the Apache 2.0 License</a>
|
3 |
+
</div>
|
demo_header.html
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div style="text-align: center;">
|
2 |
+
<h1>
|
3 |
+
Flux.1-schnell img2img
|
4 |
+
</h1>
|
5 |
+
<div class="grid-container">
|
6 |
+
<img src="https://akjava.github.io/AIDiagramChatWithVoice-FaceCharacter/webp/128/00349245_09_00002200.webp" alt="Flux.1-schnell-WebP3Frame-TalkingAnimation" class="image">
|
7 |
+
<p class="text">
|
8 |
+
Img2Img has much potential <a href="https://huggingface.co/spaces/Akjava/CreateConsistentCharacterFacialAnimationWithImg2Img" target="_blank">Create Consistent Character Facial Animation with Img2Img</a><br> Simple Classic Inapint result are good.but plain drawing is not so good,You can get best result with Gimp's Smudge Tool<br>
|
9 |
+
Img2img is good for scale-up too ,the result is more better with Gimp's sharpen<br>
|
10 |
+
Basically output face is totally difference,scale up to image to reduce that<br>
|
11 |
+
Usually result color strange,use Whitebalance tools or gimp<br>
|
12 |
+
you can clear face coverd hand with img2img + inpaint
|
13 |
+
</p>
|
14 |
+
</div>
|
15 |
+
</div>
|
16 |
+
|
demo_tools.html
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div style="text-align: center;">
|
2 |
+
<p><a href="https://huggingface.co/spaces/Akjava/AIDiagramChatWithVoice-FaceCharacter">AI Diagram Chat with Voice/Face Character Making Tools</a></p>
|
3 |
+
<p><a href="https://huggingface.co/spaces/Akjava/WebPTalkHead">[WebP-3F-TH]</a>
|
4 |
+
<a href="https://huggingface.co/spaces/Akjava/flux1-schnell-img2img">[Flux1-Img2Img(GPU)]</a>
|
5 |
+
<a href="https://huggingface.co/spaces/Akjava/flux1-schnell-mask-inpaint">[Flux1-Inpaint(GPU)]</a>
|
6 |
+
<a href="https://huggingface.co/spaces/Akjava/OpenCVInpaintCPU">[OpenCV-Inapint]</a>
|
7 |
+
<a href="https://huggingface.co/spaces/Akjava/Simple-Whitebalance-Image">[Whitebalance]</a>
|
8 |
+
<a href="https://huggingface.co/spaces/Akjava/Simple-Mask-Paste-Image">[Paste Image]</a>
|
9 |
+
<a href=" https://huggingface.co/spaces/Akjava/WebP-Resize-Convert">[WebP Resize Convert]</a></p>
|
10 |
+
</div>
|
examples/draw-gimp_input.jpg
ADDED
![]() |
Git LFS Details
|
examples/draw-gimp_output.jpg
ADDED
![]() |
Git LFS Details
|
examples/draw_input.jpg
ADDED
![]() |
Git LFS Details
|
examples/draw_output.jpg
ADDED
![]() |
Git LFS Details
|
examples/gimp_input.jpg
ADDED
![]() |
Git LFS Details
|
examples/gimp_output.jpg
ADDED
![]() |
Git LFS Details
|
examples/inpaint_input.jpg
ADDED
![]() |
Git LFS Details
|
examples/inpaint_output.jpg
ADDED
![]() |
Git LFS Details
|
flux1_img2img.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import FluxImg2ImgPipeline
|
3 |
+
|
4 |
+
from PIL import Image
|
5 |
+
import sys
|
6 |
+
import spaces
|
7 |
+
|
8 |
+
# I only test with FLUX.1-schnell
|
9 |
+
|
10 |
+
@spaces.GPU
|
11 |
+
def process_image(image,mask_image,prompt="a person",model_id="black-forest-labs/FLUX.1-schnell",strength=0.75,seed=0,num_inference_steps=4):
|
12 |
+
print("start process image process_image")
|
13 |
+
if image == None:
|
14 |
+
print("empty input image returned")
|
15 |
+
return None
|
16 |
+
|
17 |
+
pipe = FluxImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
|
18 |
+
pipe.to("cuda")
|
19 |
+
|
20 |
+
generators = []
|
21 |
+
generator = torch.Generator("cuda").manual_seed(seed)
|
22 |
+
generators.append(generator)
|
23 |
+
# more parameter see https://huggingface.co/docs/diffusers/api/pipelines/flux#diffusers.FluxInpaintPipeline
|
24 |
+
print(prompt)
|
25 |
+
output = pipe(prompt=prompt, image=image,generator=generator,strength=strength
|
26 |
+
,guidance_scale=0,num_inference_steps=num_inference_steps,max_sequence_length=256)
|
27 |
+
|
28 |
+
# TODO support mask
|
29 |
+
return output.images[0]
|
30 |
+
|
31 |
+
if __name__ == "__main__":
|
32 |
+
#args input-image input-mask output
|
33 |
+
image = Image.open(sys.argv[1])
|
34 |
+
mask = Image.open(sys.argv[2])
|
35 |
+
output = process_image(image,mask)
|
36 |
+
output.save(sys.argv[3])
|