Skip to content

Commit 019eb56

Browse files
committed
Allow generations with only text prompts
1 parent 59ce1de commit 019eb56

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cmd/vidai/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ func newGenerateCommand() *ffcli.Command {
110110
if cfg.Token == "" {
111111
return fmt.Errorf("token is required")
112112
}
113-
if *image == "" {
114-
return fmt.Errorf("image is required")
113+
if *image == "" && *text == "" {
114+
return fmt.Errorf("image or text is required")
115115
}
116116
c := vidai.New(&cfg)
117117
urls, err := c.Generate(ctx, *image, *text, *output, *extend,

vidai.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ func (c *Client) Generate(ctx context.Context, image, text, output string,
5555
}
5656
name := filepath.Base(image)
5757

58-
imageURL, err := c.client.Upload(ctx, name, b)
59-
if err != nil {
60-
return nil, fmt.Errorf("vidai: couldn't upload image: %w", err)
58+
var imageURL string
59+
if image != "" {
60+
imageURL, err = c.client.Upload(ctx, name, b)
61+
if err != nil {
62+
return nil, fmt.Errorf("vidai: couldn't upload image: %w", err)
63+
}
6164
}
6265
videoURL, err := c.client.Generate(ctx, imageURL, text, interpolate, upscale, watermark)
6366
if err != nil {

0 commit comments

Comments
 (0)