Class: RunApi::GrokImagine::Resources::ImageToVideo
- Inherits:
-
Object
- Object
- RunApi::GrokImagine::Resources::ImageToVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/grok_imagine/resources/image_to_video.rb
Overview
Grok-Imagine image-to-video generation resource. Accepts either external image_urls or a prior text-to-image task_id (+ index).
Constant Summary collapse
- ENDPOINT =
"/api/v1/grok_imagine/image_to_video"- RESPONSE_CLASS =
Types::VideoTaskResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedVideoTaskResponse
Instance Method Summary collapse
- #create(**params) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(http) ⇒ ImageToVideo
constructor
A new instance of ImageToVideo.
- #run(**params) ⇒ Object
Constructor Details
#initialize(http) ⇒ ImageToVideo
Returns a new instance of ImageToVideo.
16 17 18 |
# File 'lib/runapi/grok_imagine/resources/image_to_video.rb', line 16 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ Object
25 26 27 28 29 |
# File 'lib/runapi/grok_imagine/resources/image_to_video.rb', line 25 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ Object
31 32 33 |
# File 'lib/runapi/grok_imagine/resources/image_to_video.rb', line 31 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ Object
20 21 22 23 |
# File 'lib/runapi/grok_imagine/resources/image_to_video.rb', line 20 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |