Class: RunApi::Infinitetalk::Resources::AudioToVideo

Inherits:
Object
  • Object
show all
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

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