Spaces:
Sleeping
Sleeping
Initial commit for brand new AnySplat ZeroGPU Space
Browse files
app.py
CHANGED
|
@@ -33,6 +33,40 @@ import argparse
|
|
| 33 |
from io import BytesIO
|
| 34 |
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def process_ply_to_splat(ply_file_path):
|
| 37 |
plydata = PlyData.read(ply_file_path)
|
| 38 |
vert = plydata["vertex"]
|
|
|
|
| 33 |
from io import BytesIO
|
| 34 |
|
| 35 |
|
| 36 |
+
def extract_file_path(item):
|
| 37 |
+
path = None
|
| 38 |
+
if item is None:
|
| 39 |
+
return None
|
| 40 |
+
elif isinstance(item, str):
|
| 41 |
+
path = item
|
| 42 |
+
elif isinstance(item, tuple):
|
| 43 |
+
path = extract_file_path(item[0])
|
| 44 |
+
elif isinstance(item, dict):
|
| 45 |
+
if "path" in item and item["path"]:
|
| 46 |
+
path = item["path"]
|
| 47 |
+
elif "name" in item and item["name"]:
|
| 48 |
+
path = item["name"]
|
| 49 |
+
elif "image" in item:
|
| 50 |
+
path = extract_file_path(item["image"])
|
| 51 |
+
elif "video" in item:
|
| 52 |
+
path = extract_file_path(item["video"])
|
| 53 |
+
elif "url" in item and item["url"]:
|
| 54 |
+
path = item["url"]
|
| 55 |
+
else:
|
| 56 |
+
path = str(item)
|
| 57 |
+
else:
|
| 58 |
+
path = str(item)
|
| 59 |
+
|
| 60 |
+
if path and not os.path.isabs(path):
|
| 61 |
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 62 |
+
cand = os.path.join(base_dir, path)
|
| 63 |
+
if os.path.exists(cand):
|
| 64 |
+
return cand
|
| 65 |
+
|
| 66 |
+
return path
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
def process_ply_to_splat(ply_file_path):
|
| 71 |
plydata = PlyData.read(ply_file_path)
|
| 72 |
vert = plydata["vertex"]
|