Spaces:
Running
on
Zero
Running
on
Zero
Was getting close - now we expose an endpoint for a json state opject extract glb
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 |
+
# Launch API-only endpoint for server-to-server use if API_ONLY is set
|
276 |
+
if os.environ.get("API_ONLY"):
|
277 |
+
api_text_to_3d.launch(server_port=7861)
|
278 |
+
|
279 |
+
# API-only endpoint for server-to-server use: returns state as JSON
|
280 |
+
api_text_to_3d = gr.Interface(
|
281 |
+
fn=text_to_3d,
|
282 |
+
inputs=[
|
283 |
+
gr.Textbox(label="Text Prompt"),
|
284 |
+
gr.Number(label="Seed", value=0),
|
285 |
+
gr.Number(label="SS Guidance Strength", value=7.5),
|
286 |
+
gr.Number(label="SS Sampling Steps", value=25),
|
287 |
+
gr.Number(label="SLAT Guidance Strength", value=7.5),
|
288 |
+
gr.Number(label="SLAT Sampling Steps", value=25),
|
289 |
+
gr.Request(),
|
290 |
+
],
|
291 |
+
outputs=[gr.JSON(label="State (API only)"), gr.Textbox(label="Video Path")],
|
292 |
+
allow_flagging="never",
|
293 |
+
description="API endpoint for text_to_3d that returns the state as JSON. Not wired to UI."
|
294 |
+
)
|