传递多个图像以在Google Vision API中进行注释

问题描述

我如何传递包含绘画的种子数据以在Google Vision API中传递。我正在使用Rails后端。基本上,我不只是传递一张图像,而是尝试传递所有图像进行分析。

#Imports the Google Cloud client library
require "google/cloud/vision"
require 'net/http'
# Instantiates a client
class Trial::Painting
image_annotator = Google::Cloud::Vision.image_annotator

# The name of the image file to annotate
file_name ="https://artlogic-res.cloudinary.com/w_1600,h_1600,c_limit,f_auto,fl_lossy,q_auto/artlogicstorage/addisfineart/images/view/709288e5cbace40177a4321493a94b56/addisfineart-girma-berta-asmara-x-2018.jpg"

# Performs label detection on the image file
response = image_annotator.label_detection image: Painting.all
response.responses.each do |res|
  puts "Labels:"
  res.label_annotations.each do |label|
    puts label.description
  end
end
trial = Trial.new
end

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)