Class: Copyleaks::CopyleaksAiImageDetectionSummaryModel

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb

Overview

Summary statistics of the AI detection analysis.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(human: nil, ai: nil) ⇒ CopyleaksAiImageDetectionSummaryModel

Initialize a new CopyleaksAiImageDetectionSummaryModel

Parameters:

  • human (Float) (defaults to: nil)

    Percentage of pixels suspected to be human-created (0.0-1.0)

  • ai (Float) (defaults to: nil)

    Percentage of pixels suspected to be AI-generated (0.0-1.0)



42
43
44
45
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb', line 42

def initialize(human: nil, ai: nil)
  @human = human
  @ai = ai
end

Instance Attribute Details

#aiObject

Percentage of pixels suspected to be AI-generated. Range: 0.0-1.0



36
37
38
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb', line 36

def ai
  @ai
end

#humanObject

Percentage of pixels suspected to be human-created. Range: 0.0-1.0



32
33
34
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb', line 32

def human
  @human
end

Class Method Details

.from_json(json_hash) ⇒ Object

Create instance from JSON hash



48
49
50
51
52
53
54
55
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb', line 48

def self.from_json(json_hash)
  return nil if json_hash.nil?

  new(
    human: json_hash['human'],
    ai: json_hash['ai']
  )
end

Instance Method Details

#to_json(*args) ⇒ Object

Convert to JSON



58
59
60
61
62
63
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionSummaryModel.rb', line 58

def to_json(*args)
  {
    'human' => @human,
    'ai' => @ai
  }.to_json(*args)
end