openfree commited on
Commit
dd1c18b
·
verified ·
1 Parent(s): dc35b3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -605,12 +605,7 @@ def infer_upscale(
605
  # resize to target desired size
606
  image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
607
 
608
- # Convert the image back to PIL Image and ensure proper scaling
609
- if isinstance(image, torch.Tensor):
610
- image = image.cpu().permute(1, 2, 0).numpy()
611
- if image.max() <= 1.0:
612
- image = (image * 255).astype(np.uint8)
613
- image = Image.fromarray(image)
614
 
615
  return image, seed, num_inference_steps, upscale_factor, controlnet_conditioning_scale, gr.update(), gr.update(visible=False)
616
  except Exception as e:
@@ -808,6 +803,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
808
  upscale_randomize_seed,
809
  upscale_error
810
  ],
 
811
  ).then(
812
  infer_upscale,
813
  inputs=[
 
605
  # resize to target desired size
606
  image = image.resize((w_original * upscale_factor, h_original * upscale_factor))
607
 
608
+ # image is already a PIL Image, no need for further conversion
 
 
 
 
 
609
 
610
  return image, seed, num_inference_steps, upscale_factor, controlnet_conditioning_scale, gr.update(), gr.update(visible=False)
611
  except Exception as e:
 
803
  upscale_randomize_seed,
804
  upscale_error
805
  ],
806
+
807
  ).then(
808
  infer_upscale,
809
  inputs=[