Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -93,6 +93,10 @@ rmbg_net = BriaRMBG.from_pretrained(rmbg_weights_dir).to(DEVICE)
|
|
93 |
rmbg_net.eval()
|
94 |
pipe: PartCrafterPipeline = PartCrafterPipeline.from_pretrained(partcrafter_weights_dir).to(DEVICE, DTYPE)
|
95 |
|
|
|
|
|
|
|
|
|
96 |
@spaces.GPU()
|
97 |
@torch.no_grad()
|
98 |
def run_triposg(image_path: str,
|
@@ -144,7 +148,10 @@ def run_triposg(image_path: str,
|
|
144 |
|
145 |
glb_path = os.path.join(export_dir, "object.glb")
|
146 |
merged.export(glb_path)
|
147 |
-
|
|
|
|
|
|
|
148 |
|
149 |
# 1) Check for the file’s existence
|
150 |
if not os.path.exists(glb_path):
|
@@ -155,7 +162,7 @@ def run_triposg(image_path: str,
|
|
155 |
|
156 |
print(f"Files in {export_dir}: {all_files}")
|
157 |
|
158 |
-
return
|
159 |
|
160 |
# Gradio Interface
|
161 |
def build_demo():
|
|
|
93 |
rmbg_net.eval()
|
94 |
pipe: PartCrafterPipeline = PartCrafterPipeline.from_pretrained(partcrafter_weights_dir).to(DEVICE, DTYPE)
|
95 |
|
96 |
+
def first_file_from_dir(directory, ext):
|
97 |
+
files = glob.glob(os.path.join(directory, f"*.{ext}"))
|
98 |
+
return sorted(files)[0] if files else None
|
99 |
+
|
100 |
@spaces.GPU()
|
101 |
@torch.no_grad()
|
102 |
def run_triposg(image_path: str,
|
|
|
148 |
|
149 |
glb_path = os.path.join(export_dir, "object.glb")
|
150 |
merged.export(glb_path)
|
151 |
+
|
152 |
+
mesh_file = first_file_from_dir(export_dir, "glb")
|
153 |
+
|
154 |
+
print(mesh_file)
|
155 |
|
156 |
# 1) Check for the file’s existence
|
157 |
if not os.path.exists(glb_path):
|
|
|
162 |
|
163 |
print(f"Files in {export_dir}: {all_files}")
|
164 |
|
165 |
+
return mesh_file, export_dir
|
166 |
|
167 |
# Gradio Interface
|
168 |
def build_demo():
|