Spaces:
Runtime error
Runtime error
remove gaussian
Browse files
app.py
CHANGED
|
@@ -187,25 +187,6 @@ def extract_glb(
|
|
| 187 |
return glb_path, glb_path
|
| 188 |
|
| 189 |
|
| 190 |
-
@spaces.GPU
|
| 191 |
-
def extract_gaussian(state: dict, req: gr.Request) -> Tuple[str, str]:
|
| 192 |
-
"""
|
| 193 |
-
Extract a Gaussian file from the 3D model.
|
| 194 |
-
|
| 195 |
-
Args:
|
| 196 |
-
state (dict): The state of the generated 3D model.
|
| 197 |
-
|
| 198 |
-
Returns:
|
| 199 |
-
str: The path to the extracted Gaussian file.
|
| 200 |
-
"""
|
| 201 |
-
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 202 |
-
gs, _ = unpack_state(state)
|
| 203 |
-
gaussian_path = os.path.join(user_dir, 'sample.ply')
|
| 204 |
-
gs.save_ply(gaussian_path)
|
| 205 |
-
torch.cuda.empty_cache()
|
| 206 |
-
return gaussian_path, gaussian_path
|
| 207 |
-
|
| 208 |
-
|
| 209 |
def prepare_multi_example() -> List[Image.Image]:
|
| 210 |
multi_case = list(set([i.split('_')[0] for i in os.listdir("assets/example_multi_image")]))
|
| 211 |
images = []
|
|
@@ -267,18 +248,13 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 267 |
|
| 268 |
with gr.Row():
|
| 269 |
extract_glb_btn = gr.Button("Extract GLB", interactive=False)
|
| 270 |
-
|
| 271 |
-
gr.Markdown("""
|
| 272 |
-
*NOTE: Gaussian file can be very large (~50MB), it will take a while to display and download.*
|
| 273 |
-
""")
|
| 274 |
-
|
| 275 |
with gr.Column():
|
| 276 |
video_output = gr.Video(label="Generated 3D Asset", autoplay=True, loop=True, height=300)
|
| 277 |
-
model_output = LitModel3D(label="Extracted GLB
|
| 278 |
|
| 279 |
with gr.Row():
|
| 280 |
-
download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
|
| 281 |
-
download_gs = gr.DownloadButton(label="Download Gaussian", interactive=False)
|
| 282 |
|
| 283 |
output_buf = gr.State()
|
| 284 |
|
|
@@ -337,15 +313,6 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 337 |
lambda: gr.Button(interactive=True),
|
| 338 |
outputs=[download_glb],
|
| 339 |
)
|
| 340 |
-
|
| 341 |
-
extract_gs_btn.click(
|
| 342 |
-
extract_gaussian,
|
| 343 |
-
inputs=[output_buf],
|
| 344 |
-
outputs=[model_output, download_gs],
|
| 345 |
-
).then(
|
| 346 |
-
lambda: gr.Button(interactive=True),
|
| 347 |
-
outputs=[download_gs],
|
| 348 |
-
)
|
| 349 |
|
| 350 |
model_output.clear(
|
| 351 |
lambda: gr.Button(interactive=False),
|
|
|
|
| 187 |
return glb_path, glb_path
|
| 188 |
|
| 189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
def prepare_multi_example() -> List[Image.Image]:
|
| 191 |
multi_case = list(set([i.split('_')[0] for i in os.listdir("assets/example_multi_image")]))
|
| 192 |
images = []
|
|
|
|
| 248 |
|
| 249 |
with gr.Row():
|
| 250 |
extract_glb_btn = gr.Button("Extract GLB", interactive=False)
|
| 251 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
with gr.Column():
|
| 253 |
video_output = gr.Video(label="Generated 3D Asset", autoplay=True, loop=True, height=300)
|
| 254 |
+
model_output = LitModel3D(label="Extracted GLB", exposure=10.0, height=300)
|
| 255 |
|
| 256 |
with gr.Row():
|
| 257 |
+
download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
|
|
|
|
| 258 |
|
| 259 |
output_buf = gr.State()
|
| 260 |
|
|
|
|
| 313 |
lambda: gr.Button(interactive=True),
|
| 314 |
outputs=[download_glb],
|
| 315 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
|
| 317 |
model_output.clear(
|
| 318 |
lambda: gr.Button(interactive=False),
|