Class: RunApi::Qwen2::Resources::EditImage
- Inherits:
-
Object
- Object
- RunApi::Qwen2::Resources::EditImage
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/qwen_2/resources/edit_image.rb
Overview
Qwen2 edit-image resource. Edits images with natural-language prompts.
Constant Summary collapse
- ENDPOINT =
"/api/v1/qwen_2/edit_image"- RESPONSE_CLASS =
Types::EditImageResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedEditImageResponse
Instance Method Summary collapse
-
#create(**params) ⇒ RunApi::Qwen2::Types::EditImageResponse
Create an edit-image task.
-
#get(id) ⇒ RunApi::Qwen2::Types::EditImageResponse
Get edit-image status by task ID.
-
#initialize(http) ⇒ EditImage
constructor
A new instance of EditImage.
-
#run(**params) ⇒ RunApi::Qwen2::Types::CompletedEditImageResponse
Edit an image and wait until complete.
Constructor Details
#initialize(http) ⇒ EditImage
Returns a new instance of EditImage.
15 16 17 |
# File 'lib/runapi/qwen_2/resources/edit_image.rb', line 15 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ RunApi::Qwen2::Types::EditImageResponse
Create an edit-image task.
32 33 34 35 36 |
# File 'lib/runapi/qwen_2/resources/edit_image.rb', line 32 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ RunApi::Qwen2::Types::EditImageResponse
Get edit-image status by task ID.
42 43 44 |
# File 'lib/runapi/qwen_2/resources/edit_image.rb', line 42 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ RunApi::Qwen2::Types::CompletedEditImageResponse
Edit an image and wait until complete.
23 24 25 26 |
# File 'lib/runapi/qwen_2/resources/edit_image.rb', line 23 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |