runapi-midjourney 0.1.0 → 0.2.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06e85132c76348835ae96514c74883406ea74865d9d11525d7577e17c88f8e6f
|
|
4
|
+
data.tar.gz: 84922384c8d30f48b9798a0b0299e6ff4be448f44819cd955fe3aba2b54ef398
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e364a667e6b92db66d620c123d2fcf645d5a6c1af7342c8e209e5599129e720fb181603853158081cd4c45ebcfd26565a9ef11855c44b710b4cc0748c612572
|
|
7
|
+
data.tar.gz: 9651d5a10d8eb4d6024dca341b307445bf57a4864e8ebdd62a9b43995a55eadb64a138f8363ff0ef6047b7518a9021e8accae2a90325c6296cfc2b3e48a58a28
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Midjourney Ruby SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video, image-to-prompt, and seed lookup in Ruby applications and workers.
|
|
3
|
+
Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video, image-to-prompt, prompt shortening, and seed lookup in Ruby applications and workers.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@ result = client.text_to_image.run(
|
|
|
21
21
|
puts result.images.first.url
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Use `create`, `get`, and `run` for `text_to_image`, `edit_image`, and `image_to_video`. Use `run` directly for `image_to_prompt` and `get_seed`. Generated media URLs are temporary and should be stored in durable storage.
|
|
24
|
+
Use `create`, `get`, and `run` for `text_to_image`, `edit_image`, and `image_to_video`. Use `run` directly for `image_to_prompt`, `shorten_prompt`, and `get_seed`. Generated media URLs are temporary and should be stored in durable storage.
|
|
25
25
|
|
|
26
26
|
## Links
|
|
27
27
|
|
|
@@ -4,7 +4,7 @@ module RunApi
|
|
|
4
4
|
module Midjourney
|
|
5
5
|
# Midjourney image generation, editing, image-to-video, and helper client.
|
|
6
6
|
class Client < RunApi::Core::Client
|
|
7
|
-
attr_reader :text_to_image, :edit_image, :image_to_video, :image_to_prompt, :get_seed
|
|
7
|
+
attr_reader :text_to_image, :edit_image, :image_to_video, :image_to_prompt, :shorten_prompt, :get_seed
|
|
8
8
|
|
|
9
9
|
def initialize(api_key: nil, **options)
|
|
10
10
|
super
|
|
@@ -12,6 +12,7 @@ module RunApi
|
|
|
12
12
|
@edit_image = Resources::EditImage.new(http)
|
|
13
13
|
@image_to_video = Resources::ImageToVideo.new(http)
|
|
14
14
|
@image_to_prompt = Resources::ImageToPrompt.new(http)
|
|
15
|
+
@shorten_prompt = Resources::ShortenPrompt.new(http)
|
|
15
16
|
@get_seed = Resources::GetSeed.new(http)
|
|
16
17
|
end
|
|
17
18
|
end
|
|
@@ -49,6 +49,16 @@ module RunApi
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
+
"shorten-prompt" => {
|
|
53
|
+
"models" => [],
|
|
54
|
+
"fields_by_model" => {
|
|
55
|
+
"_" => {
|
|
56
|
+
"prompt" => {
|
|
57
|
+
"required" => true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
52
62
|
"text-to-image" => {
|
|
53
63
|
"models" => ["midjourney-v8.1"],
|
|
54
64
|
"fields_by_model" => {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module Midjourney
|
|
5
|
+
module Resources
|
|
6
|
+
# Derives concise suggestions from a prompt.
|
|
7
|
+
class ShortenPrompt
|
|
8
|
+
include RunApi::Core::ResourceHelpers
|
|
9
|
+
|
|
10
|
+
ENDPOINT = "/api/v1/midjourney/shorten_prompt"
|
|
11
|
+
RESPONSE_CLASS = Types::ShortenPromptResponse
|
|
12
|
+
|
|
13
|
+
def initialize(http) = (@http = http)
|
|
14
|
+
|
|
15
|
+
def run(options: nil, **params)
|
|
16
|
+
params = compact_params(params)
|
|
17
|
+
validate_contract!(CONTRACT["shorten-prompt"], params)
|
|
18
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -45,6 +45,12 @@ module RunApi
|
|
|
45
45
|
optional :error, String
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# Concise suggestions derived from a prompt.
|
|
49
|
+
class ShortenPromptResponse < RunApi::Core::BaseModel
|
|
50
|
+
required :prompts, [String]
|
|
51
|
+
optional :error, String
|
|
52
|
+
end
|
|
53
|
+
|
|
48
54
|
# Seed associated with a generated image.
|
|
49
55
|
class GetSeedResponse < RunApi::Core::BaseModel
|
|
50
56
|
optional :seed, Integer
|
data/lib/runapi/midjourney.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative "midjourney/resources/text_to_image"
|
|
|
7
7
|
require_relative "midjourney/resources/edit_image"
|
|
8
8
|
require_relative "midjourney/resources/image_to_video"
|
|
9
9
|
require_relative "midjourney/resources/image_to_prompt"
|
|
10
|
+
require_relative "midjourney/resources/shorten_prompt"
|
|
10
11
|
require_relative "midjourney/resources/get_seed"
|
|
11
12
|
require_relative "midjourney/client"
|
|
12
13
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-midjourney
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,16 +15,16 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.13
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.2.
|
|
25
|
+
version: 0.2.13
|
|
26
26
|
description: Use `runapi-midjourney` for Midjourney image generation, editing, image-to-video,
|
|
27
|
-
image-to-prompt, and seed lookup in Ruby applications and workers.
|
|
27
|
+
image-to-prompt, prompt shortening, and seed lookup in Ruby applications and workers.
|
|
28
28
|
email:
|
|
29
29
|
- contact@runapi.ai
|
|
30
30
|
executables: []
|
|
@@ -42,6 +42,7 @@ files:
|
|
|
42
42
|
- lib/runapi/midjourney/resources/get_seed.rb
|
|
43
43
|
- lib/runapi/midjourney/resources/image_to_prompt.rb
|
|
44
44
|
- lib/runapi/midjourney/resources/image_to_video.rb
|
|
45
|
+
- lib/runapi/midjourney/resources/shorten_prompt.rb
|
|
45
46
|
- lib/runapi/midjourney/resources/text_to_image.rb
|
|
46
47
|
- lib/runapi/midjourney/types.rb
|
|
47
48
|
homepage: https://runapi.ai/models/midjourney
|