splat-to-mesh / app.py
dylanebert's picture
dylanebert HF staff
working checkpoint
ddefedb
raw
history blame
1.66 kB
import gradio as gr
import subprocess
def run(input_ply):
subprocess.run(
"python3.10 convert.py big --force-cuda-rast --test_path " + input_ply,
shell=True,
)
return input_ply.replace(".ply", ".glb")
def main():
title = """Splat to Mesh"""
description = """
Converts Gaussian Splat (.ply) to Mesh (.glb) using [LGM](https://github.com/3DTopia/LGM).
For faster inference without waiting in a queue, you may duplicate the space and upgrade to a GPU in the settings.
"""
css = """
#duplicate-button {
margin: auto;
color: white;
background: #1565c0;
border-radius: 100vh;
}
"""
with gr.Blocks(title=title, css=css) as demo:
gr.DuplicateButton(
value="Duplicate Space for private use", elem_id="duplicate-button"
)
with gr.Row():
with gr.Column():
gr.Markdown("# " + title + "\n" + description)
with gr.Row(variant="panel"):
with gr.Column():
input_ply = gr.Model3D(label="Input Splat")
button_gen = gr.Button("Convert")
with gr.Column():
output_glb = gr.Model3D(label="Output GLB")
button_gen.click(run, inputs=[input_ply], outputs=[output_glb])
gr.Examples(
["data_test/catstatue.ply"],
inputs=[input_ply],
outputs=[output_glb],
fn=lambda x: run(x),
cache_examples=True,
label="Examples",
)
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
if __name__ == "__main__":
main()