Spaces:
Running
on
Zero
Running
on
Zero
remove external mesh conversion
Browse files
app.py
CHANGED
@@ -33,8 +33,8 @@ splat_pipeline = DiffusionPipeline.from_pretrained(
|
|
33 |
).to("cuda")
|
34 |
|
35 |
|
36 |
-
@spaces.GPU
|
37 |
-
def run(input_image
|
38 |
input_image = input_image.astype("float32") / 255.0
|
39 |
images = image_pipeline(
|
40 |
"", input_image, guidance_scale=5, num_inference_steps=30, elevation=0
|
@@ -42,18 +42,7 @@ def run(input_image, convert):
|
|
42 |
gaussians = splat_pipeline(images)
|
43 |
output_ply_path = os.path.join(TMP_DIR, "output.ply")
|
44 |
splat_pipeline.save_ply(gaussians, output_ply_path)
|
45 |
-
|
46 |
-
output_mesh_path = convert_to_mesh(output_ply_path)
|
47 |
-
return output_mesh_path
|
48 |
-
else:
|
49 |
-
return output_ply_path
|
50 |
-
|
51 |
-
|
52 |
-
def convert_to_mesh(input_ply):
|
53 |
-
client = Client("https://dylanebert-splat-to-mesh.hf.space/")
|
54 |
-
output_mesh_path = client.predict(file(input_ply), api_name="/run")
|
55 |
-
client.close()
|
56 |
-
return output_mesh_path
|
57 |
|
58 |
|
59 |
_TITLE = """LGM Mini"""
|
@@ -61,6 +50,8 @@ _TITLE = """LGM Mini"""
|
|
61 |
_DESCRIPTION = """
|
62 |
<div>
|
63 |
A lightweight version of <a href="https://huggingface.co/spaces/ashawkey/LGM">LGM: Large Multi-View Gaussian Model for High-Resolution 3D Content Creation</a>.
|
|
|
|
|
64 |
</div>
|
65 |
"""
|
66 |
|
@@ -86,19 +77,7 @@ with block:
|
|
86 |
|
87 |
with gr.Row(variant="panel"):
|
88 |
with gr.Column(scale=1):
|
89 |
-
|
90 |
-
def update_warning(checked):
|
91 |
-
if checked:
|
92 |
-
return '<span style="color: #ff0000;">Warning: Mesh conversion takes several minutes and might not work. Visit https://huggingface.co/spaces/dylanebert/splat-to-mesh to convert yourself.</span>'
|
93 |
-
else:
|
94 |
-
return ""
|
95 |
-
|
96 |
input_image = gr.Image(label="image", type="numpy")
|
97 |
-
convert_checkbox = gr.Checkbox(label="Convert to Mesh")
|
98 |
-
warning = gr.HTML()
|
99 |
-
convert_checkbox.change(
|
100 |
-
fn=update_warning, inputs=[convert_checkbox], outputs=[warning]
|
101 |
-
)
|
102 |
button_gen = gr.Button("Generate")
|
103 |
|
104 |
with gr.Column(scale=1):
|
|
|
33 |
).to("cuda")
|
34 |
|
35 |
|
36 |
+
@spaces.GPU
|
37 |
+
def run(input_image):
|
38 |
input_image = input_image.astype("float32") / 255.0
|
39 |
images = image_pipeline(
|
40 |
"", input_image, guidance_scale=5, num_inference_steps=30, elevation=0
|
|
|
42 |
gaussians = splat_pipeline(images)
|
43 |
output_ply_path = os.path.join(TMP_DIR, "output.ply")
|
44 |
splat_pipeline.save_ply(gaussians, output_ply_path)
|
45 |
+
return output_ply_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
48 |
_TITLE = """LGM Mini"""
|
|
|
50 |
_DESCRIPTION = """
|
51 |
<div>
|
52 |
A lightweight version of <a href="https://huggingface.co/spaces/ashawkey/LGM">LGM: Large Multi-View Gaussian Model for High-Resolution 3D Content Creation</a>.
|
53 |
+
|
54 |
+
To convert to mesh, download the output splat and visit [splat-to-mesh](https://huggingface.co/spaces/dylanebert/splat-to-mesh).
|
55 |
</div>
|
56 |
"""
|
57 |
|
|
|
77 |
|
78 |
with gr.Row(variant="panel"):
|
79 |
with gr.Column(scale=1):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
input_image = gr.Image(label="image", type="numpy")
|
|
|
|
|
|
|
|
|
|
|
81 |
button_gen = gr.Button("Generate")
|
82 |
|
83 |
with gr.Column(scale=1):
|