supundhananjaya commited on
Commit
4531628
·
verified ·
1 Parent(s): b964957

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -549,7 +549,9 @@ class DDIMScheduler():
549
 
550
  image_processor, swin_transformer, vae, unet, scheduler = load_models()
551
 
552
- def MonoGeoDepthModelRun(image):
 
 
553
  batch_size=1
554
  torch_device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
555
 
@@ -574,12 +576,14 @@ def MonoGeoDepthModelRun(image):
574
  noisy_latents = model_input - noise_pred[0]
575
  predicted_dtm = latent_to_tensor(noisy_latents, vae)
576
  predicted_dtm = predicted_dtm.detach().cpu()
 
577
 
578
  image_ = predicted_dtm.squeeze(0)
579
  image_ = (image_ - image_.min()) / (image_.max() - image_.min())
580
 
581
  to_pil = ToPILImage()
582
  predicted_dtm = to_pil(image_)
 
583
 
584
  return predicted_dtm
585
 
 
549
 
550
  image_processor, swin_transformer, vae, unet, scheduler = load_models()
551
 
552
+ def MonoGeoDepthModelRun(numpy_image):
553
+ numpy_image = numpy_image.astype(np.uint8)
554
+ image = Image.fromarray(numpy_image)
555
  batch_size=1
556
  torch_device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
557
 
 
576
  noisy_latents = model_input - noise_pred[0]
577
  predicted_dtm = latent_to_tensor(noisy_latents, vae)
578
  predicted_dtm = predicted_dtm.detach().cpu()
579
+ print("type 1: ",type(predicted_dtm))
580
 
581
  image_ = predicted_dtm.squeeze(0)
582
  image_ = (image_ - image_.min()) / (image_.max() - image_.min())
583
 
584
  to_pil = ToPILImage()
585
  predicted_dtm = to_pil(image_)
586
+ print("type 2: ",type(predicted_dtm))
587
 
588
  return predicted_dtm
589