Create depth_map_generator.py
Browse files- depth_map_generator.py +11 -0
depth_map_generator.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client, handle_file
|
2 |
+
|
3 |
+
def generate_depth_map(image_path):
|
4 |
+
client = Client("depth-anything/Depth-Anything-V2")
|
5 |
+
result = client.predict(
|
6 |
+
image=handle_file(image_path),
|
7 |
+
api_name="/on_submit"
|
8 |
+
)
|
9 |
+
# Extract the grayscale depth map (second item in the result tuple)
|
10 |
+
depth_map_path = result[1]
|
11 |
+
return depth_map_path
|