Spaces:
Running
on
Zero
Running
on
Zero
fix endpont state object
Browse files
app.py
CHANGED
@@ -271,4 +271,24 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
271 |
if __name__ == "__main__":
|
272 |
pipeline = TrellisTextTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-text-xlarge")
|
273 |
pipeline.cuda()
|
274 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
if __name__ == "__main__":
|
272 |
pipeline = TrellisTextTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-text-xlarge")
|
273 |
pipeline.cuda()
|
274 |
+
demo.launch()
|
275 |
+
|
276 |
+
# --- API-only endpoint for server integration ---
|
277 |
+
# This exposes text_to_3d with gr.JSON() as the first output, so the state object is included in the API response.
|
278 |
+
# Not wired to the UI; use for API calls only.
|
279 |
+
api_text_to_3d = gr.Interface(
|
280 |
+
fn=lambda prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps: text_to_3d(
|
281 |
+
prompt, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps, gr.Request()
|
282 |
+
),
|
283 |
+
inputs=[
|
284 |
+
gr.Textbox(label="Text Prompt"),
|
285 |
+
gr.Number(label="Seed"),
|
286 |
+
gr.Number(label="SS Guidance Strength"),
|
287 |
+
gr.Number(label="SS Sampling Steps"),
|
288 |
+
gr.Number(label="SLAT Guidance Strength"),
|
289 |
+
gr.Number(label="SLAT Sampling Steps"),
|
290 |
+
],
|
291 |
+
outputs=[gr.JSON(label="State Object"), gr.Textbox(label="Video Path")],
|
292 |
+
allow_flagging="never",
|
293 |
+
description="API endpoint for text_to_3d that returns the state object as JSON. Not for UI use.",
|
294 |
+
)
|