Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -174,10 +174,6 @@ def extract_gaussian(state: dict, req: gr.Request) -> Tuple[str, str]:
|
|
174 |
|
175 |
output_buf = gr.State()
|
176 |
video_output = gr.Video(label="Generated 3D Asset", autoplay=True, loop=True, height=300)
|
177 |
-
model_output = gr.Model3D(label="Extracted GLB/Gaussian", height=300)
|
178 |
-
|
179 |
-
# Add a hidden JSON output for the state object for API calls
|
180 |
-
state_output_json = gr.JSON(visible=False, label="State JSON Output")
|
181 |
|
182 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
183 |
gr.Markdown("""
|
@@ -236,8 +232,7 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
236 |
).then(
|
237 |
text_to_3d,
|
238 |
inputs=[text_prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
|
239 |
-
|
240 |
-
outputs=[state_output_json, video_output, output_buf],
|
241 |
).then(
|
242 |
lambda: tuple([gr.Button(interactive=True), gr.Button(interactive=True)]),
|
243 |
outputs=[extract_glb_btn, extract_gs_btn],
|
@@ -276,24 +271,4 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
276 |
if __name__ == "__main__":
|
277 |
pipeline = TrellisTextTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-text-xlarge")
|
278 |
pipeline.cuda()
|
279 |
-
demo.launch()
|
280 |
-
|
281 |
-
# --- API-only endpoint for server integration ---
|
282 |
-
# This exposes text_to_3d with gr.JSON() as the first output, so the state object is included in the API response.
|
283 |
-
# Not wired to the UI; use for API calls only.
|
284 |
-
api_text_to_3d = gr.Interface(
|
285 |
-
fn=lambda prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps: text_to_3d(
|
286 |
-
prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps, gr.Request()
|
287 |
-
),
|
288 |
-
inputs=[
|
289 |
-
gr.Textbox(label="Text Prompt"),
|
290 |
-
gr.Number(label="Seed"),
|
291 |
-
gr.Number(label="SS Guidance Strength"),
|
292 |
-
gr.Number(label="SS Sampling Steps"),
|
293 |
-
gr.Number(label="SLAT Guidance Strength"),
|
294 |
-
gr.Number(label="SLAT Sampling Steps"),
|
295 |
-
],
|
296 |
-
outputs=[gr.JSON(label="State Object"), gr.Textbox(label="Video Path")],
|
297 |
-
allow_flagging="never",
|
298 |
-
description="API endpoint for text_to_3d that returns the state object as JSON. Not for UI use.",
|
299 |
-
)
|
|
|
174 |
|
175 |
output_buf = gr.State()
|
176 |
video_output = gr.Video(label="Generated 3D Asset", autoplay=True, loop=True, height=300)
|
|
|
|
|
|
|
|
|
177 |
|
178 |
with gr.Blocks(delete_cache=(600, 600)) as demo:
|
179 |
gr.Markdown("""
|
|
|
232 |
).then(
|
233 |
text_to_3d,
|
234 |
inputs=[text_prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps],
|
235 |
+
outputs=[output_buf, video_output],
|
|
|
236 |
).then(
|
237 |
lambda: tuple([gr.Button(interactive=True), gr.Button(interactive=True)]),
|
238 |
outputs=[extract_glb_btn, extract_gs_btn],
|
|
|
271 |
if __name__ == "__main__":
|
272 |
pipeline = TrellisTextTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-text-xlarge")
|
273 |
pipeline.cuda()
|
274 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|