Spaces:
Runtime error
Runtime error
lionelgarnier
commited on
Commit
·
22645d0
1
Parent(s):
f04b403
uncomment 3
Browse files
app.py
CHANGED
@@ -364,23 +364,23 @@ def extract_glb(
|
|
364 |
return glb_path, glb_path
|
365 |
|
366 |
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
|
372 |
-
|
373 |
-
|
374 |
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
|
385 |
|
386 |
# Create a combined function that handles the whole pipeline from example to image
|
@@ -435,14 +435,14 @@ def create_interface():
|
|
435 |
visual_button = gr.Button("Create visual with Flux")
|
436 |
|
437 |
generated_image = gr.Image(show_label=False)
|
438 |
-
|
439 |
|
440 |
-
|
441 |
-
|
442 |
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
|
447 |
message_box = gr.Textbox(
|
448 |
label="Status Messages",
|
|
|
364 |
return glb_path, glb_path
|
365 |
|
366 |
|
367 |
+
@spaces.GPU
|
368 |
+
def extract_gaussian(state: dict) -> Tuple[str, str]:
|
369 |
+
"""
|
370 |
+
Extract a Gaussian file from the 3D model.
|
371 |
|
372 |
+
Args:
|
373 |
+
state (dict): The state of the generated 3D model.
|
374 |
|
375 |
+
Returns:
|
376 |
+
str: The path to the extracted Gaussian file.
|
377 |
+
"""
|
378 |
+
temp_dir = os.path.join(TMP_DIR, "temp_output")
|
379 |
+
gs, _ = unpack_state(state)
|
380 |
+
gaussian_path = os.path.join(temp_dir, 'sample.ply')
|
381 |
+
gs.save_ply(gaussian_path)
|
382 |
+
torch.cuda.empty_cache()
|
383 |
+
return gaussian_path, gaussian_path
|
384 |
|
385 |
|
386 |
# Create a combined function that handles the whole pipeline from example to image
|
|
|
435 |
visual_button = gr.Button("Create visual with Flux")
|
436 |
|
437 |
generated_image = gr.Image(show_label=False)
|
438 |
+
gen3d_button = gr.Button("Create 3D visual with Trellis")
|
439 |
|
440 |
+
video_output = gr.Video(label="Generated 3D Asset", autoplay=True, loop=True, height=300)
|
441 |
+
model_output = LitModel3D(label="Extracted GLB/Gaussian", exposure=10.0, height=300)
|
442 |
|
443 |
+
with gr.Row():
|
444 |
+
download_glb = gr.DownloadButton(label="Download GLB", interactive=False)
|
445 |
+
download_gs = gr.DownloadButton(label="Download Gaussian", interactive=False)
|
446 |
|
447 |
message_box = gr.Textbox(
|
448 |
label="Status Messages",
|