Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -214,6 +214,9 @@ def extract_glb(
|
|
| 214 |
Returns:
|
| 215 |
str: The path to the extracted GLB file.
|
| 216 |
"""
|
|
|
|
|
|
|
|
|
|
| 217 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 218 |
gs, mesh = unpack_state(state)
|
| 219 |
glb = postprocessing_utils.to_glb(gs, mesh, simplify=mesh_simplify, texture_size=texture_size, verbose=False)
|
|
@@ -235,6 +238,9 @@ def extract_gaussian(state: dict, req: gr.Request) -> Tuple[str, str]:
|
|
| 235 |
Returns:
|
| 236 |
str: The path to the extracted Gaussian file.
|
| 237 |
"""
|
|
|
|
|
|
|
|
|
|
| 238 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 239 |
gs, _ = unpack_state(state)
|
| 240 |
gaussian_path = os.path.join(user_dir, 'sample.ply')
|
|
@@ -428,4 +434,4 @@ if __name__ == "__main__":
|
|
| 428 |
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
| 429 |
except:
|
| 430 |
pass
|
| 431 |
-
demo.launch()
|
|
|
|
| 214 |
Returns:
|
| 215 |
str: The path to the extracted GLB file.
|
| 216 |
"""
|
| 217 |
+
if state is None:
|
| 218 |
+
raise gr.Error("Please generate a 3D model first before extracting GLB.")
|
| 219 |
+
|
| 220 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 221 |
gs, mesh = unpack_state(state)
|
| 222 |
glb = postprocessing_utils.to_glb(gs, mesh, simplify=mesh_simplify, texture_size=texture_size, verbose=False)
|
|
|
|
| 238 |
Returns:
|
| 239 |
str: The path to the extracted Gaussian file.
|
| 240 |
"""
|
| 241 |
+
if state is None:
|
| 242 |
+
raise gr.Error("Please generate a 3D model first before extracting Gaussian.")
|
| 243 |
+
|
| 244 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 245 |
gs, _ = unpack_state(state)
|
| 246 |
gaussian_path = os.path.join(user_dir, 'sample.ply')
|
|
|
|
| 434 |
pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))) # Preload rembg
|
| 435 |
except:
|
| 436 |
pass
|
| 437 |
+
demo.launch(ssr_mode=False)
|