Leap 1.0.2

dotnet add package Leap --version 1.0.2
                    
NuGet\Install-Package Leap -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Leap" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Leap" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Leap" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Leap --version 1.0.2
                    
#r "nuget: Leap, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Leap@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Leap&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Leap&version=1.0.2
                    
Install as a Cake Tool

Leap - C#

NuGet More Info

The Official Leap API

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Installation

Using the .NET Core command-line interface (CLI) tools:

dotnet add package Leap

Using the NuGet Command Line Interface (CLI):

nuget install Leap

Using the Package Manager Console:

Install-Package Leap

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "Leap".
  5. Click on the "Leap" package, select the appropriate version in the right-tab and click Install.

Getting Started

using System;
using System.Collections.Generic;
using System.Diagnostics;
using Leap.Client;
using Leap.Model;

namespace Example
{
    public class GenerateExample
    {
        public static void Main()
        {
            LeapClient client = new LeapClient();
            // Configure token for authorization
            client.SetAccessToken("YOUR_TOKEN");

            var modelId = "26a1a203-3a46-42cb-8cfa-f4de075907d8";  // The ID of the model to use to generate images. This can be a custom model, or a public model. To view the list of public models, visit: https://docs.tryleap.ai/public-models
            var prompt = "A photo of an astronaut riding a horse"; // A text description of the image you what you want to generate.
            var negativePrompt = "asymmetric, bad hands, bad hair"; // A text description of what the image should try to avoid generating.
            var steps = 50; // How many steps the AI will take to generate the image. Lower is faster but less detailed, higher is slower more detailed.
            var width = 1024; // The width of the image to use for the inference. Must be a multiple of 8. For best results use 1024x1024 for SDXL, and 512x512 for other models.
            var height = 1024; // The height of the image to use for the inference. Must be a multiple of 8. For best results use 1024x1024 for SDXL, and 512x512 for other models.
            var numberOfImages = 1; // The number of images to generate, up to 4.
            var promptStrength = 7; // The higher the prompt strength, the closer the generated image will be to the prompt. Must be between 0 and 30.
            var seed = 4523184; // A random number to use as a seed when generating the image. This is helpful if you want to generate the same image multiple times. If you want to generate different images, keep this empty or provide a random number.
            var webhookUrl = "webhookUrl_example"; // An optional webhook URL that will be called with a POST request when the image generation request completes.
            
            // The parameters to use to generate the image.
            var createInferenceDto = new CreateInferenceDto(
                prompt,
                negativePrompt,
                steps,
                width,
                height,
                numberOfImages,
                promptStrength,
                seed,
                webhookUrl
            );
            
            try
            {
                // Generate an Image
                InferenceEntity result = client.Images.Generate(modelId, createInferenceDto);
                Console.WriteLine(result);
            }
            catch (ApiException e)
            {
                Console.WriteLine("Exception when calling ImagesApi.Generate: " + e.Message);
                Console.WriteLine("Status Code: "+ e.ErrorCode);
                Console.WriteLine(e.StackTrace);
            }
            catch (ClientException e)
            {
                Console.WriteLine(e.Response.StatusCode);
                Console.WriteLine(e.Response.RawContent);
                Console.WriteLine(e.InnerException);
            }
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.tryleap.ai

Class Method HTTP request Description
ImagesApi Generate POST /api/v1/images/models/{modelId}/inferences Generate an Image
ImagesApi Delete DELETE /api/v1/images/models/{modelId}/inferences/{inferenceId} Delete Image Job
ImagesApi FindOne GET /api/v1/images/models/{modelId}/inferences/{inferenceId} Get Single Image Job
ImagesApi ListAll GET /api/v1/images/models/{modelId}/inferences List All Image Jobs
ImageModelsApi DeleteModel DELETE /api/v2/images/models/{modelId} Delete a Model
ImageModelsApi GetModel GET /api/v2/images/models/{modelId} Get a Single Model
ImageModelsApi ListAllModels GET /api/v2/images/models List All Models
ImageModelsApi TrainModel POST /api/v2/images/models/new Train Model
MusicApi FindOne GET /api/v1/music/{inferenceId} Get a Music Generation Job
MusicApi Generate POST /api/v1/music Generate Music
MusicApi ListAll GET /api/v1/music List Music Generation Jobs

Documentation for Models

Dependencies

Author

This C# package is automatically generated by Konfig

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 386 9/30/2023
1.0.1 173 9/30/2023
1.0.0 196 9/30/2023

Minor update