lehduong commited on
Commit
9078403
·
verified ·
1 Parent(s): 633e9b5

Delete inference.py

Browse files
Files changed (1) hide show
  1. inference.py +0 -37
inference.py DELETED
@@ -1,37 +0,0 @@
1
- import torch
2
- from onediffusion.diffusion.pipelines.onediffusion import OneDiffusionPipeline
3
- from PIL import Image
4
-
5
- device = torch.device('cuda:0')
6
- pipeline = OneDiffusionPipeline.from_pretrained("lehduong/OneDiffusion").to(device=device, dtype=torch.bfloat16)
7
-
8
- NEGATIVE_PROMPT = "monochrome, greyscale, low-res, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation"
9
-
10
- ## Text-to-image
11
- output = pipeline(
12
- prompt="[[text2image]] A bipedal black cat wearing a huge oversized witch hat, a wizards robe, casting a spell,in an enchanted forest. The scene is filled with fireflies and moss on surrounding rocks and trees",
13
- negative_prompt=NEGATIVE_PROMPT,
14
- num_inference_steps=50,
15
- guidance_scale=4,
16
- height=1024,
17
- width=1024,
18
- )
19
- output.images[0].save('text2image_output.jpg')
20
-
21
- ## ID Customization
22
- image = [
23
- Image.open("assets/examples/id_customization/chenhao/image_0.png"),
24
- Image.open("assets/examples/id_customization/chenhao/image_1.png"),
25
- Image.open("assets/examples/id_customization/chenhao/image_2.png")
26
- ]
27
-
28
- # input = [noise, cond_1, cond_2, cond_3]
29
- prompt = "[[faceid]] \
30
- [[img0]] A woman dressed in traditional attire with intricate headpieces, posing gracefully with a serene expression. \
31
- [[img1]] A woman with long dark hair, smiling warmly while wearing a floral dress. \
32
- [[img2]] A woman in traditional clothing holding a lace parasol, with her hair styled elegantly. \
33
- [[img3]] A woman in elaborate traditional attire and jewelry, with an ornate headdress, looking intently forward. \
34
- "
35
-
36
- ret = pipeline.img2img(image=image, num_inference_steps=75, prompt=prompt, denoise_mask=[1, 0, 0, 0], guidance_scale=4)
37
- ret.images[0].save("idcustomization_output.jpg")