class Mindee::HTTP::Endpoint

def predict(input_source, all_words, full_text, close_file, cropper)

Returns:
  • (Array) -

Parameters:
  • cropper (Boolean) -- Whether a cropping operation will be applied
  • close_file (Boolean) -- Whether the file will be closed after reading
  • full_text (Boolean) -- Whether to include the full OCR text response in compatible APIs
  • all_words (Boolean) -- Whether the full word extraction needs to be performed
  • input_source (Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::UrlInputSource) --
def predict(input_source, all_words, full_text, close_file, cropper)
  check_api_key
  response = predict_req_post(
    input_source,
    all_words: all_words,
    full_text: full_text,
    close_file: close_file,
    cropper: cropper
  )
  hashed_response = JSON.parse(response.body, object_class: Hash)
  return [hashed_response, response.body] if ResponseValidation.valid_sync_response?(response)
  ResponseValidation.clean_request!(response)
  error = Error.handle_error(@url_name, response)
  raise error
end