CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-gradio--client

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%

Overview
Eval results
Files

task.mdevals/scenario-5/

Space Cloner with Hardware Configuration

Build a tool that creates a copy of a Hugging Face Space with custom hardware settings and privacy configuration.

Description

Create a TypeScript application that duplicates Hugging Face Spaces with custom hardware tiers, privacy settings, and timeout configurations. The tool must handle authentication and verify the duplicated space is operational.

Capabilities

Basic Space Duplication

Duplicate an existing space to a new location with authentication.

  • Given a valid Hugging Face token, source space "user/source-space", and target space "user/target-space", the function successfully duplicates the space and returns the space reference @test

Hardware Tier Configuration

Configure specific hardware tiers when duplicating spaces.

  • Given hardware tier "a10g-small", the function duplicates the space with GPU hardware configured and returns hardware information in the result @test

Privacy Control

Create private duplicated spaces that require authentication to access.

  • Given private setting as true, the function creates a private duplicated space and returns isPrivate as true @test

Timeout Management

Set sleep timeout on duplicated spaces for cost optimization.

  • Given a timeout of 3600 seconds, the function duplicates the space with the specified timeout configuration @test

Implementation

@generates

API

/**
 * Configuration options for space duplication
 */
export interface DuplicateSpaceOptions {
  /** Hugging Face API token (required) */
  hfToken: string;
  /** Source space reference (e.g., "user/space-name") */
  sourceSpace: string;
  /** Target space name (e.g., "user/new-space-name") */
  targetSpace: string;
  /** Hardware tier for the duplicated space */
  hardware?: "cpu-basic" | "cpu-upgrade" | "cpu-xl" |
             "t4-small" | "t4-medium" |
             "a10g-small" | "a10g-large" | "a10g-largex2" | "a10g-largex4" |
             "a100-large" | "zero-a10g" | "h100" | "h100x8";
  /** Whether the duplicated space should be private */
  private?: boolean;
  /** Sleep timeout in seconds for cost management */
  timeout?: number;
}

/**
 * Result of space duplication operation
 */
export interface DuplicationResult {
  /** The reference to the duplicated space */
  spaceRef: string;
  /** Whether the space is private */
  isPrivate: boolean;
  /** Hardware configuration applied */
  hardware?: string;
  /** Whether connection to the space was successful */
  connected: boolean;
}

/**
 * Duplicates a Hugging Face Space with specified configuration
 *
 * @param options - Configuration for space duplication
 * @returns Promise resolving to duplication result
 * @throws Error if authentication fails or space duplication fails
 */
export async function duplicateSpace(options: DuplicateSpaceOptions): Promise<DuplicationResult>;

Dependencies { .dependencies }

@gradio/client { .dependency }

Provides client library for interacting with Gradio applications and managing Hugging Face Spaces.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-gradio--client

tile.json