linoyts HF Staff commited on
Commit
360e2a9
·
verified ·
1 Parent(s): afe56ea

remove demo reiszing (#1)

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -27,24 +27,24 @@ 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
+ # 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,
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)