Class: RunApi::Qwen2::Client

Inherits:
Core::Client
  • Object
show all
Defined in:
lib/runapi/qwen_2/client.rb

Overview

Qwen 2 image generation, remixing, and editing API client.

Three operations: pure text-to-image generation, remix (prompt-guided variation of a source image with configurable strength), and edit (targeted modifications to a source image).

Examples:

client = RunApi::Qwen2::Client.new(api_key: "your-api-key")
result = client.edit_image.run(
  model: "qwen-2-edit-image",
  prompt: "Replace the background with a neon-lit city skyline",
  source_image_url: "https://cdn.runapi.ai/public/samples/input.jpg"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Returns a new instance of Client.



26
27
28
29
30
31
# File 'lib/runapi/qwen_2/client.rb', line 26

def initialize(api_key: nil, **options)
  super
  @text_to_image = Resources::TextToImage.new(http)
  @remix_image = Resources::RemixImage.new(http)
  @edit_image = Resources::EditImage.new(http)
end

Instance Attribute Details

#edit_imageResources::EditImage (readonly)

Returns Apply targeted edits to a source image using natural-language prompts.

Returns:



24
25
26
# File 'lib/runapi/qwen_2/client.rb', line 24

def edit_image
  @edit_image
end

#remix_imageResources::RemixImage (readonly)

Returns Create prompt-guided variations with adjustable strength (0 = faithful, 1 = creative).

Returns:

  • (Resources::RemixImage)

    Create prompt-guided variations with adjustable strength (0 = faithful, 1 = creative).



22
23
24
# File 'lib/runapi/qwen_2/client.rb', line 22

def remix_image
  @remix_image
end

#text_to_imageResources::TextToImage (readonly)

Returns Generate images from text prompts.

Returns:



20
21
22
# File 'lib/runapi/qwen_2/client.rb', line 20

def text_to_image
  @text_to_image
end