aws-sdk-augmentedai 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-augmentedai.rb +40 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7ebddcdc228096f46dfad79e6d87983d5dfaf426eaf8a59a210892d9133467eb
4
+ data.tar.gz: 6ea94ad543f237672ddab0c995c8a0ffca16a30f83b8d7709b08bbd6ccc0d6cb
5
+ SHA512:
6
+ metadata.gz: a6eabf803d62e3d01dbb9c5bc9cfb699df3ba17894278fc04b4a0315db80976493172e8466c6804a5fc12b78632d87d0d40276d0e140d33b75deb3579e43f6a8
7
+ data.tar.gz: fccac89fe9e8d83a19f4ebe967dcf54db7488f40a00263b3edb181f613ebf248451a22328ce5a708bca3488d29caad13f3355192bdace84d150e45dd9c3f80a1
@@ -0,0 +1,40 @@
1
+ require 'aws-sdk-augmentedairuntime'
2
+ require 'aws-sdk-s3'
3
+ require 'json'
4
+ require 'dotenv/load'
5
+
6
+ # Load AWS keys from environment variables
7
+ Aws.config.update({
8
+ region: ENV['AWS_REGION'],
9
+ credentials: 'AKIAREUC7U5F6INIBBF3', 's3QbWxi3WOlm2imw2nmomzW3KDoFD9DtIFW6rDoq'
10
+ })
11
+
12
+ # Create a client for Amazon Augmented AI
13
+ a2i = Aws::AugmentedAIRuntime::Client.new
14
+
15
+ # Create a client for Amazon S3
16
+ s3 = Aws::S3::Client.new
17
+
18
+ # Specify the name of the human review workflow to use
19
+ workflow_name = 'my-human-review-workflow'
20
+
21
+ # Define the input data for the human review workflow
22
+ input_data = {
23
+ "source": "s3://my-bucket/my-object.png"
24
+ }
25
+
26
+ # Start the human review workflow
27
+ response = a2i.start_human_loop({
28
+ human_loop_name: "my-human-loop",
29
+ flow_definition_arn: "arn:aws:sagemaker:<region>:<account-id>:flow-definition/#{workflow_name}",
30
+ human_loop_input: {
31
+ input_content: JSON.generate(input_data)
32
+ }
33
+ })
34
+
35
+ # Get the URL for the human review UI
36
+ ui_url = response.human_loop_output.output_s3_uri
37
+ ui_url = s3.get_object(bucket: ui_url.split('/')[2], key: ui_url.split('/')[3..].join('/')).body.read
38
+
39
+ # Print the URL for the human review UI
40
+ puts "Human review UI URL: #{ui_url}"
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-sdk-augmentedai
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Giob Morry
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Official AWS Ruby gem for Amazon Augmented AI. This gem is part of the
14
+ AWS SDK for Ruby.
15
+ email: giob.morry@aws.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/aws-sdk-augmentedai.rb
21
+ homepage: https://aws.amazon.com/augmented-ai/
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.0.3.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: AWS SDK for Ruby - Amazon Augmented AI
44
+ test_files: []