Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -346,13 +346,28 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
|
|
| 346 |
|
| 347 |
# GLB 변환
|
| 348 |
with torch.inference_mode():
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
|
| 357 |
if glb is None:
|
| 358 |
print("Error: GLB conversion failed")
|
|
|
|
| 346 |
|
| 347 |
# GLB 변환
|
| 348 |
with torch.inference_mode():
|
| 349 |
+
try:
|
| 350 |
+
# 텐서들의 requires_grad를 False로 설정
|
| 351 |
+
for param in gs.parameters():
|
| 352 |
+
if hasattr(param, 'requires_grad'):
|
| 353 |
+
param.requires_grad_(False)
|
| 354 |
+
|
| 355 |
+
if hasattr(mesh, 'vertices'):
|
| 356 |
+
mesh.vertices.requires_grad_(False)
|
| 357 |
+
if hasattr(mesh, 'faces'):
|
| 358 |
+
mesh.faces.requires_grad_(False)
|
| 359 |
+
|
| 360 |
+
glb = postprocessing_utils.to_glb(
|
| 361 |
+
gs,
|
| 362 |
+
mesh,
|
| 363 |
+
simplify=mesh_simplify,
|
| 364 |
+
texture_size=texture_size,
|
| 365 |
+
verbose=True
|
| 366 |
+
)
|
| 367 |
+
|
| 368 |
+
except RuntimeError as e:
|
| 369 |
+
print(f"Runtime error during GLB conversion: {str(e)}")
|
| 370 |
+
return None, None
|
| 371 |
|
| 372 |
if glb is None:
|
| 373 |
print("Error: GLB conversion failed")
|