Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,7 @@ def text_to_3d(
|
|
88 |
slat_guidance_strength: float,
|
89 |
slat_sampling_steps: int,
|
90 |
req: gr.Request,
|
91 |
-
) ->
|
92 |
"""
|
93 |
Convert an text prompt to a 3D model.
|
94 |
|
@@ -109,7 +109,7 @@ def text_to_3d(
|
|
109 |
outputs = pipeline.run(
|
110 |
prompt,
|
111 |
seed=seed,
|
112 |
-
formats=["gaussian"
|
113 |
sparse_structure_sampler_params={
|
114 |
"steps": ss_sampling_steps,
|
115 |
"cfg_strength": ss_guidance_strength,
|
@@ -119,13 +119,13 @@ def text_to_3d(
|
|
119 |
"cfg_strength": slat_guidance_strength,
|
120 |
},
|
121 |
)
|
122 |
-
state = pack_state(outputs['gaussian'][0], outputs['mesh'][0])
|
123 |
ply_path = os.path.join(user_dir, 'point_cloud.ply')
|
124 |
gaussian_data = outputs['gaussian'][0]
|
125 |
with open(ply_path, "wb") as f:
|
126 |
gaussian_data.save_ply(f)
|
|
|
127 |
torch.cuda.empty_cache()
|
128 |
-
return
|
129 |
|
130 |
|
131 |
def extract_glb(
|
@@ -229,7 +229,7 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
229 |
).then(
|
230 |
text_to_3d,
|
231 |
inputs=[text_prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
|
232 |
-
outputs=
|
233 |
).then(
|
234 |
lambda: tuple([gr.Button(interactive=True), gr.Button(interactive=True)]),
|
235 |
outputs=[extract_glb_btn, extract_gs_btn],
|
@@ -267,7 +267,7 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
267 |
# Launch the Gradio app
|
268 |
if __name__ == "__main__":
|
269 |
parser = argparse.ArgumentParser(description="Gradio app with command-line port argument")
|
270 |
-
parser.add_argument("--port", type=int, default=
|
271 |
args = parser.parse_args()
|
272 |
port = args.port
|
273 |
pipeline = TrellisTextTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-text-xlarge")
|
|
|
88 |
slat_guidance_strength: float,
|
89 |
slat_sampling_steps: int,
|
90 |
req: gr.Request,
|
91 |
+
) -> str:
|
92 |
"""
|
93 |
Convert an text prompt to a 3D model.
|
94 |
|
|
|
109 |
outputs = pipeline.run(
|
110 |
prompt,
|
111 |
seed=seed,
|
112 |
+
formats=["gaussian"],
|
113 |
sparse_structure_sampler_params={
|
114 |
"steps": ss_sampling_steps,
|
115 |
"cfg_strength": ss_guidance_strength,
|
|
|
119 |
"cfg_strength": slat_guidance_strength,
|
120 |
},
|
121 |
)
|
|
|
122 |
ply_path = os.path.join(user_dir, 'point_cloud.ply')
|
123 |
gaussian_data = outputs['gaussian'][0]
|
124 |
with open(ply_path, "wb") as f:
|
125 |
gaussian_data.save_ply(f)
|
126 |
+
del outputs, gaussian_data
|
127 |
torch.cuda.empty_cache()
|
128 |
+
return ply_path
|
129 |
|
130 |
|
131 |
def extract_glb(
|
|
|
229 |
).then(
|
230 |
text_to_3d,
|
231 |
inputs=[text_prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
|
232 |
+
outputs=video_output,
|
233 |
).then(
|
234 |
lambda: tuple([gr.Button(interactive=True), gr.Button(interactive=True)]),
|
235 |
outputs=[extract_glb_btn, extract_gs_btn],
|
|
|
267 |
# Launch the Gradio app
|
268 |
if __name__ == "__main__":
|
269 |
parser = argparse.ArgumentParser(description="Gradio app with command-line port argument")
|
270 |
+
parser.add_argument("--port", type=int, default=8000, help="Port to run the Gradio app on")
|
271 |
args = parser.parse_args()
|
272 |
port = args.port
|
273 |
pipeline = TrellisTextTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-text-xlarge")
|