class ReceiptDataExtraction::Extract
Public Class Methods
call_vision_api(image)
click to toggle source
# File lib/receipt_data_extraction.rb, line 7 def self.call_vision_api(image) image_annotator = Google::Cloud::Vision::ImageAnnotator.new response = image_annotator.text_detection( image: image, max_results: 1 # optional, defaults to 10 ) text_detected = "" response.responses.each do |res| text_detected << res.text_annotations[0].description end return text_detected end