gokaygokay commited on
Commit
82192ca
1 Parent(s): b2cd494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -19
app.py CHANGED
@@ -24,29 +24,12 @@ def process_image(input_image):
24
  if input_image is None:
25
  return None
26
 
27
- # Ensure input_image is a numpy array
28
- input_array = np.array(input_image)
29
-
30
  # Convert to PIL Image for resizing
31
- pil_image = Image.fromarray(input_array)
32
-
33
- # Resize the longest side to 256 while maintaining aspect ratio
34
- width, height = pil_image.size
35
- if width > height:
36
- new_width = 256
37
- new_height = int(height * (256 / width))
38
- else:
39
- new_height = 256
40
- new_width = int(width * (256 / height))
41
-
42
- resized_image = pil_image.resize((new_width, new_height), Image.LANCZOS)
43
-
44
- # Convert back to numpy array
45
- resized_array = np.array(resized_image)
46
 
47
  # Upscale the image using AuraSR
48
  with torch.no_grad():
49
- upscaled_image = aura_sr.upscale_4x(resized_array)
50
 
51
  # Convert result to numpy array if it's not already
52
  result_array = np.array(upscaled_image)
 
24
  if input_image is None:
25
  return None
26
 
 
 
 
27
  # Convert to PIL Image for resizing
28
+ pil_image = Image.fromarray(input_image)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  # Upscale the image using AuraSR
31
  with torch.no_grad():
32
+ upscaled_image = aura_sr.upscale_4x(pil_image)
33
 
34
  # Convert result to numpy array if it's not already
35
  result_array = np.array(upscaled_image)