linoyts HF Staff commited on
Commit
d47d7e8
·
verified ·
1 Parent(s): 56732fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -14
app.py CHANGED
@@ -27,24 +27,11 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
27
  seed = random.randint(0, MAX_SEED)
28
 
29
  input_image = input_image.convert("RGB")
30
- original_width, original_height = input_image.size
31
 
32
- if original_width >= original_height:
33
- new_width = 1024
34
- new_height = int(original_height * (new_width / original_width))
35
- new_height = round(new_height / 64) * 64
36
- else:
37
- new_height = 1024
38
- new_width = int(original_width * (new_height / original_height))
39
- new_width = round(new_width / 64) * 64
40
-
41
- input_image_resized = input_image.resize((new_width, new_height), Image.LANCZOS)
42
  image = pipe(
43
- image=input_image_resized,
44
  prompt=prompt,
45
  guidance_scale=guidance_scale,
46
- width=new_width,
47
- height=new_height,
48
  generator=torch.Generator().manual_seed(seed),
49
  ).images[0]
50
  return image, seed, gr.update(visible=True)
 
27
  seed = random.randint(0, MAX_SEED)
28
 
29
  input_image = input_image.convert("RGB")
 
30
 
 
 
 
 
 
 
 
 
 
 
31
  image = pipe(
32
+ image=input_image,
33
  prompt=prompt,
34
  guidance_scale=guidance_scale,
 
 
35
  generator=torch.Generator().manual_seed(seed),
36
  ).images[0]
37
  return image, seed, gr.update(visible=True)