majian0318 commited on
Commit
994c791
·
verified ·
1 Parent(s): 826be9c

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +15 -18
README.md CHANGED
@@ -46,22 +46,19 @@ import torch
46
  model_name = "OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-13B-4steps"
47
  pipe = QwenImageEditPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
48
  pipe = pipe.to('cuda')
49
- output_path = 'outputs'
50
- os.makedirs(output_path, exist_ok=True)
51
- for file_name in os.listdir('examples'):
52
- prompt = file_name.replace('_in.jpg', '')
53
- subject_img = Image.open(os.path.join('examples', file_name)).convert('RGB')
54
- t1 = time.time()
55
- inputs = {
56
- "image": subject_img,
57
- "prompt": prompt,
58
- "generator": torch.manual_seed(42),
59
- "true_cfg_scale": 1,
60
- "num_inference_steps": 4,
61
- }
62
- with torch.inference_mode():
63
- output = pipe(**inputs)
64
- output_image = output.images[0]
65
- output_image.save(os.path.join(output_path, f'{prompt}.jpg'))
66
- print(time.time()-t1)
67
  ```
 
46
  model_name = "OPPOer/Qwen-Image-Edit-Pruning/Qwen-Image-Edit-13B-4steps"
47
  pipe = QwenImageEditPipeline.from_pretrained(model_name, torch_dtype=torch.bfloat16)
48
  pipe = pipe.to('cuda')
49
+
50
+ subject_img = Image.open('input.jpg').convert('RGB')
51
+ prompt = '数字插画风格'
52
+ t1 = time.time()
53
+ inputs = {
54
+ "image": subject_img,
55
+ "prompt": prompt,
56
+ "generator": torch.manual_seed(42),
57
+ "true_cfg_scale": 1,
58
+ "num_inference_steps": 4,
59
+ }
60
+ with torch.inference_mode():
61
+ output = pipe(**inputs)
62
+ output_image = output.images[0]
63
+ output_image.save('output.jpg')
 
 
 
64
  ```