replicate-ruby 0.2.0 → 0.2.1

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: 82385c582239598bb4b62a3e133228b7e6fc417ea57a047c1489e5d94d787faf
4
- data.tar.gz: 4ccecfdb33f1a4cf3218587c7ed4fa28475da1ca13369e59d5875b07e4f092f8
3
+ metadata.gz: '0840bf61f6fc1f27234815e501bc2f68a40e1af9b001c5e0df782d0e4083f2d6'
4
+ data.tar.gz: bc055f8e4f403c8917e47fd90155ae6e4d4c2216a56f7275ee7e8c8d4d2eabd4
5
5
  SHA512:
6
- metadata.gz: c8edef78b1309f5873997b33b1de5de82f2f8982ce2ec3ed32b0cdeca0e9038c77b4d56e6173441d106160e77fb1e0d2311024d5cae2c68a1fc91ef6c62cb725
7
- data.tar.gz: 56958524475fbd6636e1eb3f409b4dad100fe8179a982a746a0ee2ea4356ffa66724269a9da0e226e374bbe34c2526aacf3a358e5847ed55429ebf06700f2383
6
+ metadata.gz: 47250571e1bcafbe1b77238243229665b97e756d4a3eed92f1bbcc2f99addaa23baef4074b49f7bf784711c4b887b6e3c8c21cc019693e5a79b1b7fe6fea778c
7
+ data.tar.gz: 6e5bc89eeb116c32a81f246d044e782b85a230df7c4d19e3c3ddfb2ac2a54f5c1dc5a7772f3b2101c4a267a55b20f2a1a9e58d7c0a30fa2d950de290179775ec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- replicate-ruby (0.1.7)
4
+ replicate-ruby (0.2.1)
5
5
  addressable
6
6
  faraday (>= 2.0)
7
7
  faraday-multipart
data/README.md CHANGED
@@ -60,14 +60,13 @@ There is support for the [experimental dreambooth endpoint](https://replicate.co
60
60
 
61
61
  First, upload your training dataset:
62
62
 
63
- ```
64
- upload = Replicate.client.create_upload
65
- upload.attach('tmp/data.zip') # replace with the path to your zip file
63
+ ```ruby
64
+ upload = Replicate.client.upload_zip('tmp/data.zip') # replace with the path to your zip file
66
65
  ```
67
66
 
68
67
  Then start training a new model using, for instance:
69
68
 
70
- ```
69
+ ```ruby
71
70
  training = Replicate.client.create_training(
72
71
  input: {
73
72
  instance_prompt: "zwx style",
@@ -81,7 +80,7 @@ training = Replicate.client.create_training(
81
80
 
82
81
  As soon as the model has finished training, you can run predictions on it:
83
82
 
84
- ```
83
+ ```ruby
85
84
  prediction = Replicate.client.create_prediction(
86
85
  input: {
87
86
  prompt: 'your prompt, zwx style'
@@ -4,10 +4,18 @@ module Replicate
4
4
  class Client
5
5
  # Methods for the Prediction API
6
6
  module Upload
7
+ # Create upload object and upload zip file
8
+ def upload_zip(zip_path)
9
+ filename = zip_path.split('/')[-1]
10
+ upload = create_upload(filename)
11
+ upload.attach(zip_path)
12
+ upload
13
+ end
14
+
7
15
  # Create an upload
8
16
  # @see https://replicate.com/blog/dreambooth-api
9
- def create_upload
10
- response = dreambooth_endpoint.post("upload/data.zip")
17
+ def create_upload(filename = 'data.zip')
18
+ response = dreambooth_endpoint.post("upload/#{filename}")
11
19
  Replicate::Record::Upload.new(self, response)
12
20
  end
13
21
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Replicate
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: replicate-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dreaming Tulpa