Skip to content

Commit

Permalink
Implement last frame option
Browse files Browse the repository at this point in the history
  • Loading branch information
igolaizola committed Aug 9, 2024
1 parent 0f0a425 commit f69f554
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
1 change: 1 addition & 0 deletions pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func newGenerateCommand() *ffcli.Command {
fs.IntVar(&cfg.Width, "width", 0, "output video width (optional)")
fs.IntVar(&cfg.Height, "height", 0, "output video height (optional)")
fs.BoolVar(&cfg.Explore, "explore", false, "explore mode (optional)")
fs.BoolVar(&cfg.LastFrame, "last-frame", false, "use source image as the last frame (optional)")

return &ffcli.Command{
Name: cmd,
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Config struct {
Width int
Height int
Explore bool
LastFrame bool
}

// Run generates a video from an image and a text prompt.
Expand Down Expand Up @@ -87,6 +88,7 @@ func Run(ctx context.Context, cfg *Config) error {
Width: cfg.Width,
Height: cfg.Height,
ExploreMode: cfg.Explore,
LastFrame: cfg.LastFrame,
})
if err != nil {
return fmt.Errorf("vidai: couldn't generate video: %w", err)
Expand Down
51 changes: 27 additions & 24 deletions pkg/runway/runway.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,19 @@ type createGen3TaskRequest struct {
}

type gen3Options struct {
Name string `json:"name"`
Seconds int `json:"seconds"`
TextPrompt string `json:"text_prompt"`
Seed int `json:"seed"`
ExploreMode bool `json:"exploreMode"`
Watermark bool `json:"watermark"`
EnhancePrompt bool `json:"enhance_prompt"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Resolution string `json:"resolution,omitempty"`
InitImage string `json:"init_image,omitempty"`
AssetGroupName string `json:"assetGroupName"`
Name string `json:"name"`
Seconds int `json:"seconds"`
TextPrompt string `json:"text_prompt"`
Seed int `json:"seed"`
ExploreMode bool `json:"exploreMode"`
Watermark bool `json:"watermark"`
EnhancePrompt bool `json:"enhance_prompt"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Resolution string `json:"resolution,omitempty"`
InitImage string `json:"init_image,omitempty"`
ImageAsEndFrame bool `json:"image_as_end_frame"`
AssetGroupName string `json:"assetGroupName"`
}

type taskResponse struct {
Expand Down Expand Up @@ -352,6 +353,7 @@ type GenerateRequest struct {
Width int
Height int
ExploreMode bool
LastFrame bool
}

type Error struct {
Expand Down Expand Up @@ -487,18 +489,19 @@ func (c *Client) Generate(ctx context.Context, cfg *GenerateRequest) (*Generatio
TaskType: "gen3a",
Internal: false,
Options: gen3Options{
Name: name,
Seconds: 10,
TextPrompt: cfg.Prompt,
Seed: seed,
ExploreMode: cfg.ExploreMode,
Watermark: cfg.Watermark,
EnhancePrompt: true,
Width: width,
Height: height,
InitImage: imageURL,
Resolution: resolution,
AssetGroupName: c.folder,
Name: name,
Seconds: 10,
TextPrompt: cfg.Prompt,
Seed: seed,
ExploreMode: cfg.ExploreMode,
Watermark: cfg.Watermark,
EnhancePrompt: true,
Width: width,
Height: height,
InitImage: imageURL,
Resolution: resolution,
AssetGroupName: c.folder,
ImageAsEndFrame: cfg.LastFrame,
},
AsTeamID: c.teamID,
}
Expand Down

0 comments on commit f69f554

Please sign in to comment.