dkatz2391 commited on
Commit
36db39a
·
verified ·
1 Parent(s): 7aa6f57

api_extract_glb

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -295,7 +295,29 @@ api_text_to_3d = gr.Interface(
295
  gr.Number(label="SLAT Guidance Strength"),
296
  gr.Number(label="SLAT Sampling Steps"),
297
  ],
 
 
298
  outputs=[gr.JSON(label="State Object"), gr.Textbox(label="Video Path")],
299
  allow_flagging="never",
300
  description="API endpoint for text_to_3d that returns the state object as JSON. Not for UI use.",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  )
 
295
  gr.Number(label="SLAT Guidance Strength"),
296
  gr.Number(label="SLAT Sampling Steps"),
297
  ],
298
+ # Note: This API is technically available but not used by the server.
299
+ # The server uses the main UI endpoint modified to return JSON first.
300
  outputs=[gr.JSON(label="State Object"), gr.Textbox(label="Video Path")],
301
  allow_flagging="never",
302
  description="API endpoint for text_to_3d that returns the state object as JSON. Not for UI use.",
303
+ )
304
+
305
+ # --- API-only endpoint for GLB extraction ---
306
+ # Explicitly defines state input as JSON for server calls.
307
+ api_extract_glb = gr.Interface(
308
+ fn=lambda state, mesh_simplify, texture_size: extract_glb(
309
+ state, mesh_simplify, texture_size, gr.Request()
310
+ ),
311
+ inputs=[
312
+ gr.JSON(label="State Object"), # Expect state as JSON
313
+ gr.Slider(0.9, 0.98, label="Simplify", value=0.95, step=0.01),
314
+ gr.Slider(512, 2048, label="Texture Size", value=1024, step=512)
315
+ ],
316
+ # Corresponds to the tuple returned by extract_glb: (glb_path, glb_path)
317
+ outputs=[
318
+ gr.Model3D(label="Extracted GLB Path Output"), # Maps to first glb_path
319
+ gr.File(label="Downloadable GLB File") # Maps to second glb_path
320
+ ],
321
+ allow_flagging="never",
322
+ description="API endpoint for extract_glb that accepts state as JSON. Not for UI use.",
323
  )