runapi-topaz 0.2.1 → 0.2.5
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 +43 -0
- data/lib/runapi/topaz/resources/upscale_image.rb +2 -2
- data/lib/runapi/topaz/resources/upscale_video.rb +2 -2
- data/lib/runapi/topaz/types.rb +8 -8
- metadata +13 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40f94d07e2d993a379822f44b3a4c56e630472b9ec8a0a882c38d746f223206f
|
|
4
|
+
data.tar.gz: f8649bed0ba63f962c14e335546b81dc2d6ec61304b51976309d5bd076e39f23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59b8eee6de311173b3cd3159918352d2a6ae98714e3ec99d730dfaad9d27e3be87ac185fd76a6a9f20e2cfcbf3fa04f4a86cd6001c5c44474ee997164f27b3fb
|
|
7
|
+
data.tar.gz: 196b238d9eb37a8aecc2574515778dd46469ad2239d9015731cb2599db57e9aadacabfaebedb5797a0930f1fca120d07ea4a352721b7896989ca30139e3401ac
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Topaz API Ruby SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
The topaz api Ruby SDK is the language-specific package for Topaz on RunAPI. Use this topaz api package for image upscale, video upscale, restoration, and production cleanup flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
|
+
|
|
5
|
+
This topaz api README is the Ruby package guide inside the public `topaz-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/topaz; for API reference, use https://runapi.ai/docs#topaz; for SDK docs, use https://runapi.ai/docs#sdk-topaz.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install runapi-topaz
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "runapi-topaz"
|
|
17
|
+
|
|
18
|
+
client = RunApi::Topaz::Client.new
|
|
19
|
+
task = client.image_upscales.create(
|
|
20
|
+
# Pass the Topaz JSON request body from https://runapi.ai/docs#topaz.
|
|
21
|
+
)
|
|
22
|
+
status = client.image_upscales.get(task.id)
|
|
23
|
+
```
|
|
24
|
+
|
|
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
|
+
|
|
27
|
+
## Language notes
|
|
28
|
+
|
|
29
|
+
Use Ruby keyword arguments and the `RunApi::Topaz` error classes when building upscaling jobs, Rails workers, or scripts. The available resources include image upscales, and video upscales. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
30
|
+
|
|
31
|
+
## Links
|
|
32
|
+
|
|
33
|
+
- Model page: https://runapi.ai/models/topaz
|
|
34
|
+
- SDK docs: https://runapi.ai/docs#sdk-topaz
|
|
35
|
+
- Product docs: https://runapi.ai/docs#topaz
|
|
36
|
+
- Pricing and rate limits: https://runapi.ai/models/topaz/upscale-image
|
|
37
|
+
- Provider comparison: https://runapi.ai/providers/topaz
|
|
38
|
+
- Full catalog: https://runapi.ai/models
|
|
39
|
+
- Repository: https://github.com/runapi-ai/topaz-sdk
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -34,11 +34,11 @@ module RunApi
|
|
|
34
34
|
|
|
35
35
|
def validate_params!(params)
|
|
36
36
|
raise Core::ValidationError, "model is required" unless param(params, :model) == Types::UPSCALE_IMAGE_MODEL
|
|
37
|
-
raise Core::ValidationError, "
|
|
37
|
+
raise Core::ValidationError, "source_image_url is required" unless param(params, :source_image_url)
|
|
38
38
|
|
|
39
39
|
factor = param(params, :upscale_factor)
|
|
40
40
|
raise Core::ValidationError, "upscale_factor is required" unless factor
|
|
41
|
-
return if Types::UPSCALE_IMAGE_FACTORS.include?(factor
|
|
41
|
+
return if Types::UPSCALE_IMAGE_FACTORS.include?(factor)
|
|
42
42
|
|
|
43
43
|
raise Core::ValidationError, "upscale_factor must be one of: #{Types::UPSCALE_IMAGE_FACTORS.join(", ")}"
|
|
44
44
|
end
|
|
@@ -34,10 +34,10 @@ module RunApi
|
|
|
34
34
|
|
|
35
35
|
def validate_params!(params)
|
|
36
36
|
raise Core::ValidationError, "model is required" unless param(params, :model) == Types::UPSCALE_VIDEO_MODEL
|
|
37
|
-
raise Core::ValidationError, "
|
|
37
|
+
raise Core::ValidationError, "source_video_url is required" unless param(params, :source_video_url)
|
|
38
38
|
|
|
39
39
|
factor = param(params, :upscale_factor)
|
|
40
|
-
return unless factor && !Types::UPSCALE_VIDEO_FACTORS.include?(factor
|
|
40
|
+
return unless factor && !Types::UPSCALE_VIDEO_FACTORS.include?(factor)
|
|
41
41
|
|
|
42
42
|
raise Core::ValidationError, "upscale_factor must be one of: #{Types::UPSCALE_VIDEO_FACTORS.join(", ")}"
|
|
43
43
|
end
|
data/lib/runapi/topaz/types.rb
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Topaz
|
|
5
5
|
module Types
|
|
6
|
-
UPSCALE_IMAGE_MODEL = "topaz-image
|
|
7
|
-
UPSCALE_VIDEO_MODEL = "topaz-video
|
|
8
|
-
UPSCALE_IMAGE_FACTORS =
|
|
9
|
-
UPSCALE_VIDEO_FACTORS =
|
|
6
|
+
UPSCALE_IMAGE_MODEL = "topaz-upscale-image"
|
|
7
|
+
UPSCALE_VIDEO_MODEL = "topaz-upscale-video"
|
|
8
|
+
UPSCALE_IMAGE_FACTORS = [1, 2, 4, 8].freeze
|
|
9
|
+
UPSCALE_VIDEO_FACTORS = [1, 2, 4].freeze
|
|
10
10
|
|
|
11
11
|
class Image < RunApi::Core::BaseModel
|
|
12
12
|
optional :url, String
|
|
@@ -19,23 +19,23 @@ module RunApi
|
|
|
19
19
|
class UpscaleImageResponse < RunApi::Core::TaskResponse
|
|
20
20
|
required :id, String
|
|
21
21
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
22
|
-
optional :images, [
|
|
22
|
+
optional :images, [-> { Image }]
|
|
23
23
|
optional :error, String
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
class UpscaleVideoResponse < RunApi::Core::TaskResponse
|
|
27
27
|
required :id, String
|
|
28
28
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
29
|
-
optional :videos, [
|
|
29
|
+
optional :videos, [-> { Video }]
|
|
30
30
|
optional :error, String
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
class CompletedUpscaleImageResponse < UpscaleImageResponse
|
|
34
|
-
required :images, [
|
|
34
|
+
required :images, [-> { Image }]
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
class CompletedUpscaleVideoResponse < UpscaleVideoResponse
|
|
38
|
-
required :videos, [
|
|
38
|
+
required :videos, [-> { Video }]
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-topaz
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,22 +15,27 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 0.2.5
|
|
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:
|
|
26
|
-
description:
|
|
25
|
+
version: 0.2.5
|
|
26
|
+
description: The topaz api Ruby SDK is the language-specific package for Topaz on
|
|
27
|
+
RunAPI. Use this topaz api package for image upscale, video upscale, restoration,
|
|
28
|
+
and production cleanup flows when your application needs JSON request bodies, task
|
|
29
|
+
status lookup, and consistent RunAPI errors in Ruby.
|
|
27
30
|
email:
|
|
28
31
|
- contact@runapi.ai
|
|
29
32
|
executables: []
|
|
30
33
|
extensions: []
|
|
31
|
-
extra_rdoc_files:
|
|
34
|
+
extra_rdoc_files:
|
|
35
|
+
- README.md
|
|
32
36
|
files:
|
|
33
37
|
- LICENSE
|
|
38
|
+
- README.md
|
|
34
39
|
- lib/runapi-topaz.rb
|
|
35
40
|
- lib/runapi/topaz.rb
|
|
36
41
|
- lib/runapi/topaz/client.rb
|
|
@@ -42,7 +47,7 @@ licenses:
|
|
|
42
47
|
- Apache-2.0
|
|
43
48
|
metadata:
|
|
44
49
|
homepage_uri: https://runapi.ai/models/topaz
|
|
45
|
-
documentation_uri: https://runapi
|
|
50
|
+
documentation_uri: https://github.com/runapi-ai/topaz-sdk/blob/main/ruby/README.md
|
|
46
51
|
source_code_uri: https://github.com/runapi-ai/topaz-sdk
|
|
47
52
|
changelog_uri: https://github.com/runapi-ai/topaz-sdk/blob/main/CHANGELOG.md
|
|
48
53
|
rdoc_options: []
|
|
@@ -59,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
59
64
|
- !ruby/object:Gem::Version
|
|
60
65
|
version: '0'
|
|
61
66
|
requirements: []
|
|
62
|
-
rubygems_version: 4.0.
|
|
67
|
+
rubygems_version: 4.0.10
|
|
63
68
|
specification_version: 4
|
|
64
|
-
summary: Topaz API
|
|
69
|
+
summary: Topaz API Ruby SDK for RunAPI
|
|
65
70
|
test_files: []
|