lara-sdk 1.4.3 → 1.5.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/lara/images.rb +5 -3
- data/lib/lara/models/images.rb +13 -0
- data/lib/lara/styleguides.rb +19 -0
- data/lib/lara/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 260e413029ef25a896fb6eb641e9ca827fca770534b9510abf7ce95f6f7f9692
|
|
4
|
+
data.tar.gz: 27c8ffbed846d88f167a67ba5ba2c178528fcf47246f3288c25bd2e0e2cb773d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz: '
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0874bcc119ba9fb65b3deb2604fc5581b48022b3a4849a5faeeb61c48357baedb77d41d1523b31d5bbdf28e700f21fb2dd63c3e903aae9ed5dd9f47215c52974'
|
|
7
|
+
data.tar.gz: 88a93cf1701ba776261cec4dca86ff8468e46aec29e5328babb6912103b392c25c66935bea20c53e3a5ae804e398a5581125d50c5a70b460301fd4f3847d2ae7
|
data/lib/lara/images.rb
CHANGED
|
@@ -13,11 +13,13 @@ module Lara
|
|
|
13
13
|
# @param adapt_to [Array<String>, nil] Memory IDs for translation adaptation.
|
|
14
14
|
# @param glossaries [Array<String>, nil] Glossary IDs to apply.
|
|
15
15
|
# @param style [String, nil] Translation style ("faithful", "fluid", "creative").
|
|
16
|
-
# @param
|
|
16
|
+
# @param model [String, nil] Image translation model. One of the +Lara::Models::ImageTranslationModel+ constants
|
|
17
|
+
# (+OVERLAY+, +INPAINTING+, +GENERATIVE+, +GENERATIVE_FAST+).
|
|
18
|
+
# @param text_removal [String, nil] Deprecated. Use +model+ instead.
|
|
17
19
|
# @param no_trace [Boolean] If true, disables request tracing.
|
|
18
20
|
# @return [String] Binary image data of the translated image.
|
|
19
21
|
def translate(file_path:, target:, source: nil, adapt_to: nil, glossaries: nil,
|
|
20
|
-
style: nil, text_removal: nil, no_trace: false)
|
|
22
|
+
style: nil, model: nil, text_removal: nil, no_trace: false)
|
|
21
23
|
image_upload = Faraday::Multipart::FilePart.new(file_path, mime_type_for(file_path))
|
|
22
24
|
|
|
23
25
|
body = {
|
|
@@ -26,7 +28,7 @@ module Lara
|
|
|
26
28
|
adapt_to: adapt_to&.to_json,
|
|
27
29
|
glossaries: glossaries&.to_json,
|
|
28
30
|
style: style,
|
|
29
|
-
|
|
31
|
+
model: model || text_removal
|
|
30
32
|
}.compact
|
|
31
33
|
|
|
32
34
|
headers = {}
|
data/lib/lara/models/images.rb
CHANGED
|
@@ -5,6 +5,19 @@ require_relative "text"
|
|
|
5
5
|
|
|
6
6
|
module Lara
|
|
7
7
|
module Models
|
|
8
|
+
module ImageTranslationModel
|
|
9
|
+
OVERLAY = "overlay"
|
|
10
|
+
INPAINTING = "inpainting"
|
|
11
|
+
GENERATIVE = "generative"
|
|
12
|
+
GENERATIVE_FAST = "generative_fast"
|
|
13
|
+
|
|
14
|
+
ALL = [OVERLAY, INPAINTING, GENERATIVE, GENERATIVE_FAST].freeze
|
|
15
|
+
|
|
16
|
+
def self.valid?(value)
|
|
17
|
+
ALL.include?(value)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
8
21
|
class ImageParagraph < Base
|
|
9
22
|
attr_reader :text, :translation, :adapted_to_matches, :glossaries_matches
|
|
10
23
|
|
data/lib/lara/styleguides.rb
CHANGED
|
@@ -13,6 +13,13 @@ module Lara
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
# @return [Lara::Models::Styleguide]
|
|
17
|
+
def create(name:, content:)
|
|
18
|
+
Lara::Models::Styleguide.new(**@client.post("/v2/styleguides",
|
|
19
|
+
body: { name: name,
|
|
20
|
+
content: content }).transform_keys(&:to_sym))
|
|
21
|
+
end
|
|
22
|
+
|
|
16
23
|
# @return [Lara::Models::Styleguide,nil]
|
|
17
24
|
def get(id)
|
|
18
25
|
Lara::Models::Styleguide.new(**@client.get("/v2/styleguides/#{id}").transform_keys(&:to_sym))
|
|
@@ -21,5 +28,17 @@ module Lara
|
|
|
21
28
|
|
|
22
29
|
raise
|
|
23
30
|
end
|
|
31
|
+
|
|
32
|
+
# @return [Lara::Models::Styleguide]
|
|
33
|
+
def update(id, name: nil, content: nil)
|
|
34
|
+
Lara::Models::Styleguide.new(**@client.put("/v2/styleguides/#{id}",
|
|
35
|
+
body: { name: name,
|
|
36
|
+
content: content }.compact).transform_keys(&:to_sym))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [Lara::Models::Styleguide]
|
|
40
|
+
def delete(id)
|
|
41
|
+
Lara::Models::Styleguide.new(**@client.delete("/v2/styleguides/#{id}").transform_keys(&:to_sym))
|
|
42
|
+
end
|
|
24
43
|
end
|
|
25
44
|
end
|
data/lib/lara/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lara-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Translated
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|