Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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
|
|
|
|
| 7 |
|
| 8 |
-
|
| 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)
|