runapi-happyhorse 0.2.11 → 0.3.0
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/lib/runapi/happyhorse/resources/edit_video.rb +0 -20
- data/lib/runapi/happyhorse/resources/image_to_video.rb +0 -19
- data/lib/runapi/happyhorse/resources/text_to_video.rb +0 -26
- data/lib/runapi/happyhorse/types.rb +0 -4
- data/lib/runapi/happyhorse.rb +0 -1
- metadata +4 -5
- data/lib/runapi/happyhorse/contract_gen.rb +0 -134
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54da5aacee13c56a123cfcdacc7ff973db3a0f52ba8728f84118d9c8d21bfea4
|
|
4
|
+
data.tar.gz: 42430691fee7f1dd87eea44350ad6bbc3fa43eda54d120d0ed963693a6634d88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73701212edd67ae523c29ab6fb8c05f4d1c8f7b9c9ee789ee1e10a168212ed86050cd85db42335fd5aaf9d5fb6f8127c5c6ad735d27f1f7afb6d278badc399ce
|
|
7
|
+
data.tar.gz: 2737015aeabef8adfe12104cfc1c755aa7cee47bf681e21617119b56e3f3c35171ddc948b7912b396ed4483408558b2814b68dea2effb4d4015c3d7c07ac2e5e
|
|
@@ -32,7 +32,6 @@ module RunApi
|
|
|
32
32
|
# @return [RunApi::HappyHorse::Types::EditVideoResponse] task creation result with id
|
|
33
33
|
def create(options: nil, **params)
|
|
34
34
|
params = compact_params(params)
|
|
35
|
-
validate_params!(params)
|
|
36
35
|
request(:post, ENDPOINT, body: params, options: options)
|
|
37
36
|
end
|
|
38
37
|
|
|
@@ -43,25 +42,6 @@ module RunApi
|
|
|
43
42
|
def get(id, options: nil)
|
|
44
43
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
45
44
|
end
|
|
46
|
-
|
|
47
|
-
private
|
|
48
|
-
|
|
49
|
-
def validate_params!(params)
|
|
50
|
-
validate_contract!(CONTRACT["edit-video"], params)
|
|
51
|
-
|
|
52
|
-
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
53
|
-
|
|
54
|
-
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def validate_integer_range!(params, key, range)
|
|
58
|
-
value = param(params, key)
|
|
59
|
-
return unless value
|
|
60
|
-
|
|
61
|
-
return if value.is_a?(Integer) && range.cover?(value)
|
|
62
|
-
|
|
63
|
-
raise Core::ValidationError, "#{key} must be an integer between #{range.min} and #{range.max}"
|
|
64
|
-
end
|
|
65
45
|
end
|
|
66
46
|
end
|
|
67
47
|
end
|
|
@@ -32,7 +32,6 @@ module RunApi
|
|
|
32
32
|
# @return [RunApi::HappyHorse::Types::ImageToVideoResponse] task creation result with id
|
|
33
33
|
def create(options: nil, **params)
|
|
34
34
|
params = compact_params(params)
|
|
35
|
-
validate_params!(params)
|
|
36
35
|
request(:post, ENDPOINT, body: params, options: options)
|
|
37
36
|
end
|
|
38
37
|
|
|
@@ -43,24 +42,6 @@ module RunApi
|
|
|
43
42
|
def get(id, options: nil)
|
|
44
43
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
45
44
|
end
|
|
46
|
-
|
|
47
|
-
private
|
|
48
|
-
|
|
49
|
-
def validate_params!(params)
|
|
50
|
-
validate_contract!(CONTRACT["image-to-video"], params)
|
|
51
|
-
|
|
52
|
-
validate_integer_range!(params, :duration_seconds, Types::DURATION_RANGE)
|
|
53
|
-
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def validate_integer_range!(params, key, range)
|
|
57
|
-
value = param(params, key)
|
|
58
|
-
return unless value
|
|
59
|
-
|
|
60
|
-
return if value.is_a?(Integer) && range.cover?(value)
|
|
61
|
-
|
|
62
|
-
raise Core::ValidationError, "#{key} must be an integer between #{range.min} and #{range.max}"
|
|
63
|
-
end
|
|
64
45
|
end
|
|
65
46
|
end
|
|
66
47
|
end
|
|
@@ -32,7 +32,6 @@ module RunApi
|
|
|
32
32
|
# @return [RunApi::HappyHorse::Types::TextToVideoResponse] task creation result with id
|
|
33
33
|
def create(options: nil, **params)
|
|
34
34
|
params = compact_params(params)
|
|
35
|
-
validate_params!(params)
|
|
36
35
|
request(:post, ENDPOINT, body: params, options: options)
|
|
37
36
|
end
|
|
38
37
|
|
|
@@ -43,31 +42,6 @@ module RunApi
|
|
|
43
42
|
def get(id, options: nil)
|
|
44
43
|
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
45
44
|
end
|
|
46
|
-
|
|
47
|
-
private
|
|
48
|
-
|
|
49
|
-
def validate_params!(params)
|
|
50
|
-
validate_contract!(CONTRACT["text-to-video"], params)
|
|
51
|
-
|
|
52
|
-
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
53
|
-
|
|
54
|
-
reference_image_urls = param(params, :reference_image_urls)
|
|
55
|
-
if param(params, :model) != Types::CHARACTER_MODEL && reference_image_urls
|
|
56
|
-
raise Core::ValidationError, "reference_image_urls is only supported for #{Types::CHARACTER_MODEL}"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
validate_integer_range!(params, :duration_seconds, Types::DURATION_RANGE)
|
|
60
|
-
validate_integer_range!(params, :seed, Types::SEED_RANGE)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def validate_integer_range!(params, key, range)
|
|
64
|
-
value = param(params, key)
|
|
65
|
-
return unless value
|
|
66
|
-
|
|
67
|
-
return if value.is_a?(Integer) && range.cover?(value)
|
|
68
|
-
|
|
69
|
-
raise Core::ValidationError, "#{key} must be an integer between #{range.min} and #{range.max}"
|
|
70
|
-
end
|
|
71
45
|
end
|
|
72
46
|
end
|
|
73
47
|
end
|
|
@@ -9,10 +9,6 @@ module RunApi
|
|
|
9
9
|
HAPPYHORSE_1_0_T2V_MODEL = "happyhorse-1.0-t2v"
|
|
10
10
|
HAPPYHORSE_1_0_R2V_MODEL = "happyhorse-1.0-r2v"
|
|
11
11
|
HAPPYHORSE_1_0_I2V_MODEL = "happyhorse-1.0-i2v"
|
|
12
|
-
# Duration range in seconds (3-15). Defaults to 5.
|
|
13
|
-
DURATION_RANGE = (3..15)
|
|
14
|
-
# Reproducibility seed range.
|
|
15
|
-
SEED_RANGE = (0..2_147_483_647)
|
|
16
12
|
|
|
17
13
|
# A generated video file with a download URL.
|
|
18
14
|
class MediaUrl < RunApi::Core::BaseModel
|
data/lib/runapi/happyhorse.rb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "runapi/core"
|
|
4
4
|
require_relative "happyhorse/types"
|
|
5
|
-
require_relative "happyhorse/contract_gen"
|
|
6
5
|
require_relative "happyhorse/resources/edit_video"
|
|
7
6
|
require_relative "happyhorse/resources/image_to_video"
|
|
8
7
|
require_relative "happyhorse/resources/text_to_video"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-happyhorse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.6.0
|
|
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.
|
|
25
|
+
version: 0.6.0
|
|
26
26
|
description: The HappyHorse Ruby SDK is the language-specific package for HappyHorse
|
|
27
27
|
on RunAPI. Use this package for video generation, animation, and video editing workflows
|
|
28
28
|
when your application needs request bodies, task status lookup, and consistent RunAPI
|
|
@@ -39,7 +39,6 @@ files:
|
|
|
39
39
|
- lib/runapi-happyhorse.rb
|
|
40
40
|
- lib/runapi/happyhorse.rb
|
|
41
41
|
- lib/runapi/happyhorse/client.rb
|
|
42
|
-
- lib/runapi/happyhorse/contract_gen.rb
|
|
43
42
|
- lib/runapi/happyhorse/resources/edit_video.rb
|
|
44
43
|
- lib/runapi/happyhorse/resources/image_to_video.rb
|
|
45
44
|
- lib/runapi/happyhorse/resources/text_to_video.rb
|
|
@@ -68,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
68
67
|
- !ruby/object:Gem::Version
|
|
69
68
|
version: '0'
|
|
70
69
|
requirements: []
|
|
71
|
-
rubygems_version: 4.0.
|
|
70
|
+
rubygems_version: 4.0.10
|
|
72
71
|
specification_version: 4
|
|
73
72
|
summary: HappyHorse API Ruby SDK for RunAPI
|
|
74
73
|
test_files: []
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RunApi
|
|
4
|
-
module HappyHorse
|
|
5
|
-
CONTRACT = {
|
|
6
|
-
"edit-video" => {
|
|
7
|
-
"models" => ["happyhorse-edit-video"],
|
|
8
|
-
"fields_by_model" => {
|
|
9
|
-
"happyhorse-edit-video" => {
|
|
10
|
-
"audio_setting" => {
|
|
11
|
-
"enum" => ["auto", "original"]
|
|
12
|
-
},
|
|
13
|
-
"output_resolution" => {
|
|
14
|
-
"enum" => ["720p", "1080p"]
|
|
15
|
-
},
|
|
16
|
-
"reference_image_urls" => {
|
|
17
|
-
"max_items" => 5
|
|
18
|
-
},
|
|
19
|
-
"seed" => {
|
|
20
|
-
"type" => "integer"
|
|
21
|
-
},
|
|
22
|
-
"source_video_url" => {
|
|
23
|
-
"required" => true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"image-to-video" => {
|
|
29
|
-
"models" => ["happyhorse-1.0-i2v", "happyhorse-image-to-video"],
|
|
30
|
-
"fields_by_model" => {
|
|
31
|
-
"happyhorse-1.0-i2v" => {
|
|
32
|
-
"duration_seconds" => {
|
|
33
|
-
"type" => "integer"
|
|
34
|
-
},
|
|
35
|
-
"first_frame_image_url" => {
|
|
36
|
-
"required" => true
|
|
37
|
-
},
|
|
38
|
-
"output_resolution" => {
|
|
39
|
-
"enum" => ["720p", "1080p"]
|
|
40
|
-
},
|
|
41
|
-
"seed" => {
|
|
42
|
-
"type" => "integer"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"happyhorse-image-to-video" => {
|
|
46
|
-
"duration_seconds" => {
|
|
47
|
-
"type" => "integer"
|
|
48
|
-
},
|
|
49
|
-
"first_frame_image_url" => {
|
|
50
|
-
"required" => true
|
|
51
|
-
},
|
|
52
|
-
"output_resolution" => {
|
|
53
|
-
"enum" => ["720p", "1080p"]
|
|
54
|
-
},
|
|
55
|
-
"seed" => {
|
|
56
|
-
"type" => "integer"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"text-to-video" => {
|
|
62
|
-
"models" => ["happyhorse-1.0-r2v", "happyhorse-1.0-t2v", "happyhorse-character", "happyhorse-text-to-video"],
|
|
63
|
-
"fields_by_model" => {
|
|
64
|
-
"happyhorse-1.0-r2v" => {
|
|
65
|
-
"aspect_ratio" => {
|
|
66
|
-
"enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
|
|
67
|
-
},
|
|
68
|
-
"duration_seconds" => {
|
|
69
|
-
"type" => "integer"
|
|
70
|
-
},
|
|
71
|
-
"output_resolution" => {
|
|
72
|
-
"enum" => ["720p", "1080p"]
|
|
73
|
-
},
|
|
74
|
-
"reference_image_urls" => {
|
|
75
|
-
"required" => true,
|
|
76
|
-
"min_items" => 1,
|
|
77
|
-
"max_items" => 9
|
|
78
|
-
},
|
|
79
|
-
"seed" => {
|
|
80
|
-
"type" => "integer"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"happyhorse-1.0-t2v" => {
|
|
84
|
-
"aspect_ratio" => {
|
|
85
|
-
"enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
|
|
86
|
-
},
|
|
87
|
-
"duration_seconds" => {
|
|
88
|
-
"type" => "integer"
|
|
89
|
-
},
|
|
90
|
-
"output_resolution" => {
|
|
91
|
-
"enum" => ["720p", "1080p"]
|
|
92
|
-
},
|
|
93
|
-
"seed" => {
|
|
94
|
-
"type" => "integer"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"happyhorse-character" => {
|
|
98
|
-
"aspect_ratio" => {
|
|
99
|
-
"enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
|
|
100
|
-
},
|
|
101
|
-
"duration_seconds" => {
|
|
102
|
-
"type" => "integer"
|
|
103
|
-
},
|
|
104
|
-
"output_resolution" => {
|
|
105
|
-
"enum" => ["720p", "1080p"]
|
|
106
|
-
},
|
|
107
|
-
"reference_image_urls" => {
|
|
108
|
-
"required" => true,
|
|
109
|
-
"min_items" => 1,
|
|
110
|
-
"max_items" => 9
|
|
111
|
-
},
|
|
112
|
-
"seed" => {
|
|
113
|
-
"type" => "integer"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"happyhorse-text-to-video" => {
|
|
117
|
-
"aspect_ratio" => {
|
|
118
|
-
"enum" => ["16:9", "9:16", "1:1", "4:3", "3:4"]
|
|
119
|
-
},
|
|
120
|
-
"duration_seconds" => {
|
|
121
|
-
"type" => "integer"
|
|
122
|
-
},
|
|
123
|
-
"output_resolution" => {
|
|
124
|
-
"enum" => ["720p", "1080p"]
|
|
125
|
-
},
|
|
126
|
-
"seed" => {
|
|
127
|
-
"type" => "integer"
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}.freeze
|
|
133
|
-
end
|
|
134
|
-
end
|