cloudflare-ai 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c727f28c32fdfa8aace3c440ccd7c4f99e0edf9c60a35605dd386dfb1e83f3d9
4
- data.tar.gz: 2a405251e064c93fc9de0bb4f27da57e0bdb342400cfc867ae4a92384494af4b
3
+ metadata.gz: c0dbb7a703cef587e4c132ced954abc6be79bb903fe6e2b1d531ae8a1bd22ad9
4
+ data.tar.gz: f59a67ae6ff4785994269a65bce16f3bc22d284dfc3fcdac5d4d846b70e5e2b7
5
5
  SHA512:
6
- metadata.gz: f10b2c9ee7dbdfef2ac61c8a425bfb6d1f06ccddab9296c86cfcf097f243e499b5498dbcd0163ac03e31c5ae845f9ab54bcd506f73e2533ce172eb360336dfd4
7
- data.tar.gz: a01a5743d7d845813582317b50d9bc131c981c884191eff0890286d2a85881801f9eda768ec6246693192aa086a5fd771580e2fcab4865f881e054bc810cdcaf
6
+ metadata.gz: 55ab260777dfdfb4427f20e06c2a3522226db63bd869a627ed0abbd7c83948d33f37585f2249c1417ae590b0267934b5ce9e7444df03df95fad8b4d1334c0a12
7
+ data.tar.gz: 1716e968bf8f7694de57eadf3b003a5e4cd76cb25b240112a8561830c2fe16cd17a769af02662024edb32efc860675520356431cd2dd8cfc132db58ae7c8a165
data/README.md CHANGED
@@ -194,6 +194,36 @@ result = client.transcribe(audio: File.open("/path/to/audio.wav"))
194
194
  #### Result object
195
195
  All invocations of the `transcribe` method returns a `Cloudflare::AI::Results::Transcribe`.
196
196
 
197
+ ### Summarization
198
+ ```ruby
199
+ result = client.summarize(text: "This text should be a lot longer.")
200
+ p result.summary # => {"result":{"summary":"Short text"},"success":true,"errors":[],"messages":[]}
201
+ ```
202
+ #### Result object
203
+ All invocations of the `summarize` method returns a `Cloudflare::AI::Results::Summarization` object.
204
+
205
+ ### Object detection
206
+ The object detection endpoint accepts either a path to a file or a file stream.
207
+
208
+ ```ruby
209
+ result = client.detect_objects(image: "/path/to/cat.jpg")
210
+ result = client.classify(image: File.open("/path/to/cat.jpg"))
211
+ ```
212
+
213
+ #### Result object
214
+ All invocations of the `detect_objects` method returns a `Cloudflare::AI::Results::ObjectDetection` object.
215
+
216
+ ### Image-to-text
217
+ The captioning endpoint accepts either a path to a file or a file stream.
218
+
219
+ ```ruby
220
+ client.caption(image: "/path/to/cat.jpg").description # => "a cat sitting on a couch"
221
+ client.caption(image: File.open("/path/to/cat.jpg")).description # => "a cat sitting on a couch"
222
+ ```
223
+
224
+ #### Result object
225
+ All invocations of the `caption` method returns a `Cloudflare::AI::Results::ImageToText` object.
226
+
197
227
  # Logging
198
228
 
199
229
  This gem uses standard logging mechanisms and defaults to `:warn` level. Most messages are at info level, but we will add debug or warn statements as needed.
@@ -28,7 +28,7 @@ class Cloudflare::AI::Models
28
28
  end
29
29
 
30
30
  def object_detection
31
- %w[@cf/meta/det-resnet-50]
31
+ %w[@cf/meta/detr-resnet-50]
32
32
  end
33
33
 
34
34
  def summarization
@@ -1,3 +1,5 @@
1
1
  class Cloudflare::AI::Results::ImageToText < Cloudflare::AI::Result
2
- # Empty seam kept for consistency with other result objects that have more complexity.
2
+ def description
3
+ result&.dig(:description) # nil if no shape
4
+ end
3
5
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cloudflare
4
4
  module AI
5
- VERSION = "0.9.1"
5
+ VERSION = "0.9.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ajay Krishnan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-28 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel