replicate-go

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: Apache-2.0

README

Replicate Go client

A Go client for Replicate. It lets you run models from your Go code, and everything else you can do with Replicate's HTTP API.

Requirements

  • Go 1.20+

Installation

Use go get to install the Replicate package:

go get -u github.com/replicate/replicate-go@latest

Include the Replicate package in your project:

import "github.com/replicate/replicate-go/pkg/replicate"

Usage

import (
	"context"
	"os"

	"github.com/replicate/replicate-go/pkg/replicate"
)

client := replicate.NewClient(os.Getenv("REPLICATE_API_TOKEN"))

// https://replicate.com/stability-ai/stable-diffusion
version := "db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
input := replicate.PredictionInput{
    "prompt": "an astronaut riding a horse on mars, hd, dramatic lighting",
}
prediction, err := client.CreatePrediction(context.Background(), version, input)

License

Replicate's Go client is released under the Apache 2.0 license. See LICENSE.txt

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL