runapi-infinitetalk 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -14
- data/lib/runapi/infinitetalk/client.rb +15 -5
- data/lib/runapi/infinitetalk/contract_gen.rb +27 -0
- data/lib/runapi/infinitetalk/resources/audio_to_video.rb +3 -16
- data/lib/runapi/infinitetalk/types.rb +4 -3
- data/lib/runapi/infinitetalk.rb +1 -0
- metadata +11 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e89cac6baa5f9d175c9fd56314131d2af51d6487c9a9367e61938f3627f003c8
|
|
4
|
+
data.tar.gz: fb5b1c2e61201b5a9d6459cfb361c7f967d9b35cd9264b9b37eab0692acc250c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e77fd019642d0bfb19b9646134df5f273d6cc6dfde150d98d8d7fb5ea50ae3b64844031145ecfb9e9c8e3db4d78ef37795ec2c1e9db8a13cd55fb4446b0c539
|
|
7
|
+
data.tar.gz: 53d70b3746b85b30ff80863c5c50fcc615831ad0f0dd6fca4846a0db9d2f203d26e2d8152c09f58eb21d9b29bd80b9ce0d8b70fc3b72e6c6fbb91916283fcd54
|
data/README.md
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# InfiniteTalk Ruby SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The InfiniteTalk Ruby SDK is the language-specific package for InfiniteTalk on RunAPI. Use this package for video generation, animation, and video editing workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
4
|
|
|
5
|
-
This
|
|
5
|
+
This README is the Ruby package guide inside the public `infinitetalk-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/infinitetalk; for API reference, use https://runapi.ai/docs#infinitetalk; for SDK docs, use https://runapi.ai/docs#sdk-infinitetalk.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
gem install runapi-
|
|
10
|
+
gem install runapi-infinitetalk
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick start
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
require "runapi-
|
|
16
|
+
require "runapi-infinitetalk"
|
|
17
17
|
|
|
18
18
|
client = RunApi::Infinitalk::Client.new
|
|
19
|
-
task = client.
|
|
20
|
-
# Pass the InfiniteTalk JSON request body from https://runapi.ai/docs#
|
|
19
|
+
task = client.audio_to_video.create(
|
|
20
|
+
# Pass the InfiniteTalk JSON request body from https://runapi.ai/docs#infinitetalk.
|
|
21
21
|
)
|
|
22
|
-
status = client.
|
|
22
|
+
status = client.audio_to_video.get(task.id)
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
26
26
|
|
|
27
|
+
RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
|
|
28
|
+
|
|
27
29
|
## Language notes
|
|
28
30
|
|
|
29
|
-
Use Ruby keyword arguments and the `RunApi::Infinitalk` error classes when building video jobs, Rails workers, or scripts. The available resources
|
|
31
|
+
Use Ruby keyword arguments and the `RunApi::Infinitalk` error classes when building video jobs, Rails workers, or scripts. The available resources are `audio_to_video`. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
30
32
|
|
|
31
33
|
## Links
|
|
32
34
|
|
|
33
|
-
- Model page: https://runapi.ai/models/
|
|
34
|
-
- SDK docs: https://runapi.ai/docs#sdk-
|
|
35
|
-
- Product docs: https://runapi.ai/docs#
|
|
36
|
-
- Pricing and rate limits: https://runapi.ai/models/
|
|
35
|
+
- Model page: https://runapi.ai/models/infinitetalk
|
|
36
|
+
- SDK docs: https://runapi.ai/docs#sdk-infinitetalk
|
|
37
|
+
- Product docs: https://runapi.ai/docs#infinitetalk
|
|
38
|
+
- Pricing and rate limits: https://runapi.ai/models/infinitetalk
|
|
37
39
|
- Provider comparison: https://runapi.ai/providers/meigen-ai
|
|
38
40
|
- Full catalog: https://runapi.ai/models
|
|
39
|
-
- Repository: https://github.com/runapi-ai/
|
|
41
|
+
- Repository: https://github.com/runapi-ai/infinitetalk-sdk
|
|
40
42
|
|
|
41
43
|
## License
|
|
42
44
|
|
|
@@ -2,14 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Infinitetalk
|
|
5
|
-
|
|
5
|
+
# InfiniteTalk lip-sync video generation client. Produces talking-head videos
|
|
6
|
+
# by animating a portrait image to match an audio track's speech or singing.
|
|
7
|
+
#
|
|
8
|
+
# @example
|
|
9
|
+
# client = RunApi::Infinitetalk::Client.new(api_key: "sk-...")
|
|
10
|
+
# result = client.audio_to_video.run(
|
|
11
|
+
# model: "infinitetalk-from-audio",
|
|
12
|
+
# source_image_url: "https://cdn.runapi.ai/public/samples/portrait.jpg",
|
|
13
|
+
# source_audio_url: "https://cdn.runapi.ai/public/samples/voice.mp3",
|
|
14
|
+
# prompt: "A young woman talking on a podcast"
|
|
15
|
+
# )
|
|
16
|
+
# puts result.videos.first.url
|
|
17
|
+
class Client < RunApi::Core::Client
|
|
18
|
+
# @return [Resources::AudioToVideo] Lip-synced video generation from a portrait image and audio track.
|
|
6
19
|
attr_reader :audio_to_video
|
|
7
20
|
|
|
8
21
|
def initialize(api_key: nil, **options)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
client_options = Core::ClientOptions.new(api_key: @api_key, **options)
|
|
12
|
-
http = client_options.http_client || Core::HttpClient.new(client_options)
|
|
22
|
+
super
|
|
13
23
|
@audio_to_video = Resources::AudioToVideo.new(http)
|
|
14
24
|
end
|
|
15
25
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module Infinitetalk
|
|
5
|
+
CONTRACT = {
|
|
6
|
+
"audio-to-video" => {
|
|
7
|
+
"models" => ["infinitetalk-from-audio"],
|
|
8
|
+
"fields_by_model" => {
|
|
9
|
+
"infinitetalk-from-audio" => {
|
|
10
|
+
"output_resolution" => {
|
|
11
|
+
"enum" => ["480p", "720p"]
|
|
12
|
+
},
|
|
13
|
+
"seed" => {
|
|
14
|
+
"type" => "integer"
|
|
15
|
+
},
|
|
16
|
+
"source_audio_url" => {
|
|
17
|
+
"required" => true
|
|
18
|
+
},
|
|
19
|
+
"source_image_url" => {
|
|
20
|
+
"required" => true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}.freeze
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Infinitetalk
|
|
5
5
|
module Resources
|
|
6
|
+
# Generates lip-synced talking-head videos from a portrait image and an audio track.
|
|
7
|
+
# The output video shows the person speaking or singing in sync with the audio.
|
|
6
8
|
class AudioToVideo
|
|
7
9
|
include RunApi::Core::ResourceHelpers
|
|
8
10
|
|
|
@@ -34,22 +36,14 @@ module RunApi
|
|
|
34
36
|
private
|
|
35
37
|
|
|
36
38
|
def validate_params!(params)
|
|
37
|
-
|
|
38
|
-
raise Core::ValidationError, "model is required" unless model
|
|
39
|
-
unless Types::MODELS.include?(model)
|
|
40
|
-
raise Core::ValidationError, "Invalid model: #{model}. Must be one of: #{Types::MODELS.join(", ")}"
|
|
41
|
-
end
|
|
39
|
+
validate_contract!(CONTRACT["audio-to-video"], params)
|
|
42
40
|
|
|
43
|
-
validate_required!(params, :source_image_url)
|
|
44
|
-
validate_required!(params, :source_audio_url)
|
|
45
41
|
prompt = param(params, :prompt)
|
|
46
42
|
raise Core::ValidationError, "prompt is required" unless prompt.is_a?(String) && !prompt.empty?
|
|
47
43
|
if prompt.length > PROMPT_MAX_LENGTH
|
|
48
44
|
raise Core::ValidationError, "prompt must be at most #{PROMPT_MAX_LENGTH} characters"
|
|
49
45
|
end
|
|
50
46
|
|
|
51
|
-
validate_optional!(params, :output_resolution, Types::RESOLUTIONS)
|
|
52
|
-
|
|
53
47
|
seed = param(params, :seed)
|
|
54
48
|
return if seed.nil?
|
|
55
49
|
|
|
@@ -58,13 +52,6 @@ module RunApi
|
|
|
58
52
|
|
|
59
53
|
raise Core::ValidationError, "seed must be an integer between #{SEED_RANGE.min} and #{SEED_RANGE.max}"
|
|
60
54
|
end
|
|
61
|
-
|
|
62
|
-
def validate_required!(params, key)
|
|
63
|
-
value = param(params, key)
|
|
64
|
-
return if value.is_a?(String) ? !value.empty? : !value.nil?
|
|
65
|
-
|
|
66
|
-
raise Core::ValidationError, "#{key} is required"
|
|
67
|
-
end
|
|
68
55
|
end
|
|
69
56
|
end
|
|
70
57
|
end
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Infinitetalk
|
|
5
5
|
module Types
|
|
6
|
-
|
|
7
|
-
RESOLUTIONS = %w[480p 720p].freeze
|
|
8
|
-
|
|
6
|
+
# A generated video asset.
|
|
9
7
|
class Video < RunApi::Core::BaseModel
|
|
10
8
|
optional :url, String
|
|
11
9
|
end
|
|
12
10
|
|
|
11
|
+
# Result of an audio-to-video generation task.
|
|
12
|
+
# While processing, +videos+ is nil; once completed, it contains the generated lip-synced video(s).
|
|
13
13
|
class AudioToVideoResponse < RunApi::Core::TaskResponse
|
|
14
14
|
required :id, String
|
|
15
15
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
@@ -17,6 +17,7 @@ module RunApi
|
|
|
17
17
|
optional :error, String
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# Narrowed response type guaranteed to contain completed videos.
|
|
20
21
|
class CompletedAudioToVideoResponse < AudioToVideoResponse
|
|
21
22
|
required :videos, [-> { Video }]
|
|
22
23
|
end
|
data/lib/runapi/infinitetalk.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-infinitetalk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,18 +15,18 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.7
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.2.
|
|
26
|
-
description: The
|
|
27
|
-
on RunAPI. Use this
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
version: 0.2.7
|
|
26
|
+
description: The InfiniteTalk Ruby SDK is the language-specific package for InfiniteTalk
|
|
27
|
+
on RunAPI. Use this package for video generation, animation, and video editing workflows
|
|
28
|
+
when your application needs request bodies, task status lookup, and consistent RunAPI
|
|
29
|
+
errors in Ruby.
|
|
30
30
|
email:
|
|
31
31
|
- contact@runapi.ai
|
|
32
32
|
executables: []
|
|
@@ -39,15 +39,18 @@ files:
|
|
|
39
39
|
- lib/runapi-infinitetalk.rb
|
|
40
40
|
- lib/runapi/infinitetalk.rb
|
|
41
41
|
- lib/runapi/infinitetalk/client.rb
|
|
42
|
+
- lib/runapi/infinitetalk/contract_gen.rb
|
|
42
43
|
- lib/runapi/infinitetalk/resources/audio_to_video.rb
|
|
43
44
|
- lib/runapi/infinitetalk/types.rb
|
|
44
45
|
homepage: https://runapi.ai/models/infinitetalk
|
|
45
46
|
licenses:
|
|
46
47
|
- Apache-2.0
|
|
47
48
|
metadata:
|
|
49
|
+
runapi_slug: infinitetalk
|
|
48
50
|
homepage_uri: https://runapi.ai/models/infinitetalk
|
|
49
51
|
documentation_uri: https://github.com/runapi-ai/infinitetalk-sdk/blob/main/ruby/README.md
|
|
50
52
|
source_code_uri: https://github.com/runapi-ai/infinitetalk-sdk
|
|
53
|
+
bug_tracker_uri: https://github.com/runapi-ai/infinitetalk-sdk/issues
|
|
51
54
|
changelog_uri: https://github.com/runapi-ai/infinitetalk-sdk/blob/main/CHANGELOG.md
|
|
52
55
|
rdoc_options: []
|
|
53
56
|
require_paths:
|
|
@@ -65,5 +68,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
65
68
|
requirements: []
|
|
66
69
|
rubygems_version: 4.0.10
|
|
67
70
|
specification_version: 4
|
|
68
|
-
summary:
|
|
71
|
+
summary: InfiniteTalk Ruby SDK for RunAPI
|
|
69
72
|
test_files: []
|