akhaliq HF staff commited on
Commit
dc9d69c
1 Parent(s): 024a2b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -3,14 +3,16 @@ from PIL import Image
3
  import src.depth_pro as depth_pro
4
  import numpy as np
5
  import matplotlib.pyplot as plt
6
- import os
 
7
 
8
- os.system("source get_pretrained_models.sh")
9
 
10
  # Load model and preprocessing transform
11
  model, transform = depth_pro.create_model_and_transforms()
12
  model.eval()
13
 
 
14
  def predict_depth(input_image):
15
  # Preprocess the image
16
  result = depth_pro.load_rgb(input_image.name)
 
3
  import src.depth_pro as depth_pro
4
  import numpy as np
5
  import matplotlib.pyplot as plt
6
+ import subprocess
7
+ import spaces
8
 
9
+ subprocess.run(["bash", "get_pretrained_models.sh"])
10
 
11
  # Load model and preprocessing transform
12
  model, transform = depth_pro.create_model_and_transforms()
13
  model.eval()
14
 
15
+ @spaces.GPU(duration=120)
16
  def predict_depth(input_image):
17
  # Preprocess the image
18
  result = depth_pro.load_rgb(input_image.name)