Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Angles = map[string]string{
"three-quarter-left": anglePrompt("a three-quarter view, head and shoulders turned about 45 degrees to their left"),
"three-quarter-right": anglePrompt("a three-quarter view, head and shoulders turned about 45 degrees to their right"),
"left-profile": anglePrompt("a full side profile facing left"),
"right-profile": anglePrompt("a full side profile facing right"),
}
Angles maps each generatable view to the image-edit prompt that produces it from the front photo. Prompts ask for a neutral, closed mouth so the shots suit lip-sync models.
var DefaultAngles = []string{"three-quarter-left", "three-quarter-right"}
DefaultAngles are generated when the caller does not choose: the two three-quarter views hold identity better than full profiles.
var ImageExtensions = []string{".png", ".jpg", ".jpeg", ".webp"}
ImageExtensions are the portrait formats an avatar folder may hold.
Functions ¶
Types ¶
type Avatar ¶
Avatar is one library entry. Images are the folder's portrait file names in sorted order; the first is the primary image lip-sync models receive.
func Create ¶
func Create(ctx context.Context, dir, name, photo string, angles []string, edit EditFunc) (Avatar, error)
Create builds a new avatar folder dir/<name>/ from a front photo: the photo is stored as the primary image (01-front.<ext>), a JPEG upright and without metadata, and each angle is generated from that stored image concurrently with edit and saved as NN-<angle>.png in the order given. An existing avatar is never overwritten, and on any failure the half-built folder is removed.