Spaces:
Paused
Paused
A newer version of the Gradio SDK is available: 6.12.0
TypeScript API Client - Quick Start
✅ Fixed and Ready to Use!
The TypeScript API client is now working. Here's how to use it:
🚀 Usage
Option 1: With Environment Variable (Recommended)
# Set your Space URL
export INSTANTSPLAT_SPACE="your-username/InstantSplat"
# Run the client
npm run api test01/IMG_8533.jpeg test01/IMG_8534.jpeg test01/IMG_8535.jpeg
Option 2: Programmatic Usage
import { processImages } from "./api_client.js";
const result = await processImages(
["img1.jpg", "img2.jpg", "img3.jpg"],
"your-username/InstantSplat" // Specify Space URL here
);
if (result.status === "success") {
console.log("GLB URL:", result.glb_url);
console.log("PLY URL:", result.ply_url);
}
Option 3: Local Instance
If running the app locally:
# Terminal 1: Start the app
python app.py
# Terminal 2: Use the client (no Space URL needed)
npm run api img1.jpg img2.jpg img3.jpg
🔧 What Was Fixed
- ✅ Fixed
@gradio/clientimport (usesclientfunction, notClientclass) - ✅ Fixed ES module compatibility (
import.meta.urlinstead ofrequire.main) - ✅ Updated all examples and documentation
📝 Complete Example
import { processImages, completeWorkflow } from "./api_client.js";
// Example 1: Get URLs only
async function getURLs() {
const result = await processImages(
["img1.jpg", "img2.jpg", "img3.jpg"],
"your-username/InstantSplat"
);
if (result.status === "success") {
return {
glb: result.glb_url,
ply: result.ply_url
};
}
}
// Example 2: Process and download
async function processAndDownload() {
const localPath = await completeWorkflow(
["img1.jpg", "img2.jpg", "img3.jpg"],
"./models",
"your-username/InstantSplat"
);
console.log("Model saved to:", localPath);
}
🎯 Next Steps
- Deploy your Space to HuggingFace
- Get your Space URL (e.g.,
username/InstantSplat) - Run the client with your Space URL
- Integrate into your TypeScript/JavaScript application
📚 Full Documentation
API_TYPESCRIPT.md- Complete TypeScript API referenceexample_api_usage.ts- Working examplesREADME_TS.md- General TypeScript client guide