aifeifei798 commited on
Commit
91af729
·
verified ·
1 Parent(s): 04c9dac

Upload feifeiimgtoimg.py

Browse files
Files changed (1) hide show
  1. feifeilib/feifeiimgtoimg.py +12 -12
feifeilib/feifeiimgtoimg.py CHANGED
@@ -10,9 +10,9 @@ from diffusers.utils import load_image
10
 
11
  dtype = torch.bfloat16
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
- pipe = FluxImg2ImgPipeline.from_pretrained("aifeifei798/shuttle-3-diffusion",
14
  torch_dtype=dtype)
15
- pipe = pipe.to(device)
16
  MAX_SEED = np.iinfo(np.int32).max
17
 
18
  @spaces.GPU()
@@ -22,14 +22,14 @@ def feifeiimgtoimg(img_in_result,
22
  seed = random.randint(0, MAX_SEED)
23
  generator = torch.Generator().manual_seed(seed)
24
  init_image = load_image(img_in_result)
25
- images = pipe(prompt="",
26
- prompt_2=prompt,
27
- image=init_image,
28
- width=896,
29
- height=1152,
30
- num_inference_steps=4,
31
- strength=0.95,
32
- generator=generator,
33
- utput_type="pil",
34
- guidance_scale=3.5).images[0]
35
  return images
 
10
 
11
  dtype = torch.bfloat16
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
+ img_pipe = FluxImg2ImgPipeline.from_pretrained("aifeifei798/shuttle-3-diffusion",
14
  torch_dtype=dtype)
15
+ img_pipe = img_pipe.to(device)
16
  MAX_SEED = np.iinfo(np.int32).max
17
 
18
  @spaces.GPU()
 
22
  seed = random.randint(0, MAX_SEED)
23
  generator = torch.Generator().manual_seed(seed)
24
  init_image = load_image(img_in_result)
25
+ images = img_pipe(prompt="",
26
+ prompt_2=prompt,
27
+ image=init_image,
28
+ width=896,
29
+ height=1152,
30
+ num_inference_steps=4,
31
+ strength=0.95,
32
+ generator=generator,
33
+ utput_type="pil",
34
+ guidance_scale=3.5).images[0]
35
  return images