JavaScript and TypeScript client library for interacting with Gradio APIs, providing methods to connect to, submit predictions to, and manage connections with Gradio applications.
Overall
score
96%
Build a utility that processes image galleries for submission to a Gradio API endpoint. The utility should handle collections of images with metadata and prepare them for upload.
Your solution should implement a function that:
Accepts an array of image data where each image can be:
Processes the gallery array to extract and organize all image data, maintaining:
Returns a structured collection ready for API submission, where each image entry contains:
Given an array of 3 File objects with names "photo1.jpg", "photo2.png", "photo3.jpg", the function returns a processed gallery array with 3 entries, each preserving the original filename and extracting correct MIME types @test
Given an empty array, the function returns an empty processed gallery array @test
Given a nested gallery structure (array of arrays) containing File objects, the function recursively processes all images while maintaining the nested structure @test
@generates
/**
* Processes a gallery of images for submission to a Gradio API.
*
* @param gallery - Array of image data (Files, Blobs, or image objects)
* @returns Processed gallery array with complete metadata
*/
export function processGallery(gallery: any[]): any[];Provides utilities for handling file uploads and gallery data structures in Gradio applications.
Install with Tessl CLI
npx tessl i tessl/npm-gradio--clientevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10