Skip to content

Commit 670fef5

Browse files
committed
Refactor organization
1 parent 2f42e40 commit 670fef5

File tree

4 files changed

+502
-492
lines changed

4 files changed

+502
-492
lines changed

examples/research_projects/anytext/README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,24 @@ import torch
2222
from pipeline_anytext import AnyTextPipeline
2323
from text_controlnet import TextControlNetModel
2424
from diffusers import DDIMScheduler
25+
from diffusers.utils import load_image
2526

2627

27-
controlnet = TextControlNetModel.from_pretrained("a/b", subfolder="controlnet", torch_dtype=torch.float16)
28-
model_id = "path-to-model"
29-
pipe = AnyTextPipeline.from_pretrained("a/b", subfolder="base", controlnet=controlnet, torch_dtype=torch.float16, variant="fp16")
28+
controlnet = TextControlNetModel.from_pretrained("tolgacangoz/anytext-controlnet", torch_dtype=torch.float16,
29+
variant="fp16")
30+
pipe = AnyTextPipeline.from_pretrained("tolgacangoz/anytext", controlnet=controlnet,
31+
torch_dtype=torch.float16, variant="fp16")
3032

3133
# speed up diffusion process with faster scheduler and memory optimization
3234
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
3335
# uncomment following line if torch<2.0
3436
#pipe.enable_xformers_memory_efficient_attention()
3537
pipe.enable_model_cpu_offload()
3638
# generate image
37-
generator = torch.Generator("cpu").manual_seed(0)
38-
image = pipe("photo of caramel macchiato coffee on the table, top-down perspective, with "Any" "Text" written on it using cream", num_inference_steps=20, generator=generator).images[0]
39+
generator = torch.Generator("cpu").manual_seed(66273235)
40+
prompt = 'photo of caramel macchiato coffee on the table, top-down perspective, with "Any" "Text" written on it using cream'
41+
draw_pos = load_image("www.huggingface.co/a/AnyText/tree/main/examples/gen9.png")
42+
image = pipe(prompt, num_inference_steps=20, generator=generator, mode="generate", draw_pos=draw_pos,
43+
).images[0]
3944
image
4045
```

examples/research_projects/anytext/auxiliary_latent_module.py

Lines changed: 0 additions & 184 deletions
This file was deleted.

0 commit comments

Comments
 (0)