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 real-time monitoring application that connects to a Gradio streaming endpoint and processes Server-Sent Events (SSE) with support for multiple protocol versions.
Your application should connect to a Gradio API endpoint that generates streaming data and:
Your application should output:
@generates
/**
* Monitors a streaming Gradio endpoint and processes SSE events
* @param appUrl - The URL of the Gradio application
* @param endpoint - The endpoint name or numeric ID
* @param data - Input data array for the endpoint
* @returns Promise that resolves when stream completes with event counts
*/
export async function monitorStream(
appUrl: string,
endpoint: string | number,
data: unknown[]
): Promise<{
dataEvents: number;
statusEvents: number;
logEvents: number;
}>;
/**
* Monitors a streaming endpoint with cancellation support
* @param appUrl - The URL of the Gradio application
* @param endpoint - The endpoint name or numeric ID
* @param data - Input data array for the endpoint
* @param timeoutMs - Optional timeout in milliseconds after which to cancel
* @returns Promise that resolves when stream completes or is cancelled
*/
export async function monitorStreamWithTimeout(
appUrl: string,
endpoint: string | number,
data: unknown[],
timeoutMs?: number
): Promise<{
dataEvents: number;
statusEvents: number;
logEvents: number;
cancelled: boolean;
}>;Provides client functionality for connecting to Gradio applications and handling SSE streaming.
@satisfied-by
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