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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -5
- data/lib/replicate/client/upload.rb +10 -2
- data/lib/replicate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0840bf61f6fc1f27234815e501bc2f68a40e1af9b001c5e0df782d0e4083f2d6'
|
4
|
+
data.tar.gz: bc055f8e4f403c8917e47fd90155ae6e4d4c2216a56f7275ee7e8c8d4d2eabd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47250571e1bcafbe1b77238243229665b97e756d4a3eed92f1bbcc2f99addaa23baef4074b49f7bf784711c4b887b6e3c8c21cc019693e5a79b1b7fe6fea778c
|
7
|
+
data.tar.gz: 6e5bc89eeb116c32a81f246d044e782b85a230df7c4d19e3c3ddfb2ac2a54f5c1dc5a7772f3b2101c4a267a55b20f2a1a9e58d7c0a30fa2d950de290179775ec
|
data/Gemfile.lock
CHANGED
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.
|
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
|
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
|
|
data/lib/replicate/version.rb
CHANGED