Class: RunApi::Wan::Resources::ImageToVideo
- Inherits:
-
Object
- Object
- RunApi::Wan::Resources::ImageToVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/wan/resources/image_to_video.rb
Overview
Generates videos driven by a source image. Flash variants trade fidelity for speed; 2.7 adds last-frame control, video continuation, and audio features. On WAN 2.6, multi_shots controls whether the generated video uses multiple shots with transitions instead of one continuous shot.
Constant Summary collapse
- ENDPOINT =
"/api/v1/wan/image_to_video"- RESPONSE_CLASS =
Types::VideoTaskResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedVideoTaskResponse
Instance Method Summary collapse
-
#create(options: nil, **params) ⇒ RunApi::Wan::Types::VideoTaskResponse
Create an image-to-video generation task.
-
#get(id, options: nil) ⇒ RunApi::Wan::Types::VideoTaskResponse
Get image-to-video status by task ID.
-
#initialize(http) ⇒ ImageToVideo
constructor
A new instance of ImageToVideo.
-
#run(options: nil, **params) ⇒ RunApi::Wan::Types::CompletedVideoTaskResponse
Generate a video from an image and wait until complete.
Constructor Details
#initialize(http) ⇒ ImageToVideo
Returns a new instance of ImageToVideo.
17 18 19 |
# File 'lib/runapi/wan/resources/image_to_video.rb', line 17 def initialize(http) @http = http end |
Instance Method Details
#create(options: nil, **params) ⇒ RunApi::Wan::Types::VideoTaskResponse
Create an image-to-video generation task.
34 35 36 37 38 |
# File 'lib/runapi/wan/resources/image_to_video.rb', line 34 def create(options: nil, **params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params, options: ) end |
#get(id, options: nil) ⇒ RunApi::Wan::Types::VideoTaskResponse
Get image-to-video status by task ID.
44 45 46 |
# File 'lib/runapi/wan/resources/image_to_video.rb', line 44 def get(id, options: nil) request(:get, "#{ENDPOINT}/#{id}", options: ) end |
#run(options: nil, **params) ⇒ RunApi::Wan::Types::CompletedVideoTaskResponse
Generate a video from an image and wait until complete.
25 26 27 28 |
# File 'lib/runapi/wan/resources/image_to_video.rb', line 25 def run(options: nil, **params) task = create(options: , **params) poll_until_complete { get(task.id, options: ) } end |