Edits history of script submission #12512 for ' Create using Universal Upscaler (leonardoai)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Leonardoai = {
      apiKey: string;
    };
    /**
     * Create using Universal Upscaler
     * This endpoint will create a high resolution image using Universal Upscaler
     */
    export async function main(
      auth: Leonardoai,
      body: {
        creativityStrength?: number;
        detailContrast?: number;
        generatedImageId?: string;
        initImageId?: string;
        prompt?: string;
        similarity?: number;
        ultraUpscaleStyle?: "ARTISTIC" | "REALISTIC";
        upscaleMultiplier?: number;
        upscalerStyle?:
          | "GENERAL"
          | "CINEMATIC"
          | "2D ART & ILLUSTRATION"
          | "CG ART & GAME ASSETS";
        variationId?: string;
      },
    ) {
      const url = new URL(
        `https://cloud.leonardo.ai/api/rest/v1/variations/universal-upscaler`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.apiKey,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 428 days ago