Add progress indicators
Browse files
app.py
CHANGED
|
@@ -8,9 +8,11 @@ depth_estimator = MidasDepth()
|
|
| 8 |
|
| 9 |
|
| 10 |
def get_depth(rgb):
|
|
|
|
| 11 |
rgb = rgb.convert("RGB")
|
| 12 |
depth = depth_estimator.get_depth(rgb)
|
| 13 |
|
|
|
|
| 14 |
w, h = rgb.size
|
| 15 |
grid = np.mgrid[0:h, 0:w].transpose(1, 2, 0
|
| 16 |
).reshape(-1, 2)[..., ::-1]
|
|
@@ -36,6 +38,7 @@ def get_depth(rgb):
|
|
| 36 |
[(~pick_edges.flatten()) * (x < w - 1) * (y < h - 1)]
|
| 37 |
))
|
| 38 |
|
|
|
|
| 39 |
tf = tempfile.NamedTemporaryFile(suffix=".obj").name
|
| 40 |
save_obj(positions, np.asarray(rgb).reshape(-1, 3), faces, tf)
|
| 41 |
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def get_depth(rgb):
|
| 11 |
+
print("Estimating depth...")
|
| 12 |
rgb = rgb.convert("RGB")
|
| 13 |
depth = depth_estimator.get_depth(rgb)
|
| 14 |
|
| 15 |
+
print("Creating mesh...")
|
| 16 |
w, h = rgb.size
|
| 17 |
grid = np.mgrid[0:h, 0:w].transpose(1, 2, 0
|
| 18 |
).reshape(-1, 2)[..., ::-1]
|
|
|
|
| 38 |
[(~pick_edges.flatten()) * (x < w - 1) * (y < h - 1)]
|
| 39 |
))
|
| 40 |
|
| 41 |
+
print("Writing...")
|
| 42 |
tf = tempfile.NamedTemporaryFile(suffix=".obj").name
|
| 43 |
save_obj(positions, np.asarray(rgb).reshape(-1, 3), faces, tf)
|
| 44 |
|