Class: RunApi::Infinitetalk::Resources::AudioToVideo
- Inherits:
-
Object
- Object
- RunApi::Infinitetalk::Resources::AudioToVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/infinitetalk/resources/audio_to_video.rb
Overview
Generates lip-synced talking-head videos from a portrait image and an audio track. The output video shows the person speaking or singing in sync with the audio.
Constant Summary collapse
- ENDPOINT =
"/api/v1/infinitetalk/audio_to_video"- RESPONSE_CLASS =
Types::AudioToVideoResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedAudioToVideoResponse
- PROMPT_MAX_LENGTH =
5000- SEED_RANGE =
(10_000..1_000_000)
Instance Method Summary collapse
- #create(**params) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(http) ⇒ AudioToVideo
constructor
A new instance of AudioToVideo.
- #run(**params) ⇒ Object
Constructor Details
#initialize(http) ⇒ AudioToVideo
Returns a new instance of AudioToVideo.
17 18 19 |
# File 'lib/runapi/infinitetalk/resources/audio_to_video.rb', line 17 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ Object
26 27 28 29 30 |
# File 'lib/runapi/infinitetalk/resources/audio_to_video.rb', line 26 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ Object
32 33 34 |
# File 'lib/runapi/infinitetalk/resources/audio_to_video.rb', line 32 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ Object
21 22 23 24 |
# File 'lib/runapi/infinitetalk/resources/audio_to_video.rb', line 21 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |