R 管道工API接受API评分图像

R 管道工API接受API评分图像,r,rest,api,post,plumber,R,Rest,Api,Post,Plumber,我正在尝试编写一个水管工函数来接受图像并对图像进行评分,然后返回评分结果。所以我想弄清楚有两个部分 第1部分:编写水管工函数,这就是我的全部想法 #* @post /imageAnalysistest scoreFunction = function(image){ ******* need help figuring this part *********** image_read(image) %>% image_write(paste0(path,"temp.jpg

我正在尝试编写一个水管工函数来接受图像并对图像进行评分,然后返回评分结果。所以我想弄清楚有两个部分

第1部分:编写水管工函数,这就是我的全部想法

#* @post /imageAnalysistest
scoreFunction =  function(image){
  ******* need help figuring this part ***********
  image_read(image) %>%
    image_write(paste0(path,"temp.jpg"))
 **************************************************


  # preprocess image
  x = image_load(paste0(path,"temp.jpg"),target_size =  c(img_width, img_height)) %>% 
    array_reshape(c(-1,img_width, img_height, channels))


  # do predictions
  probs = model %>% predict(x, steps = as.integer(test_samples/batch_size), verbose = 1)

  return(probs)
}
我试着通过如下,它打印了一堆字符。我猜是把图像转换成角色

#* @post /imageAnalysistest
scoreFunction =  function(req){
print(req$postBody)
}
第2部分:卷曲数据以发送文件在图像上打分

curl \
  -F "image=@/home/550.jpg" \
    http://192.168.1.1:8085/imageAnalysistest
TLDR:我正在尝试编写一个水管工函数来接受图像,以便在图像识别模型上进行评分。我可以发送一个原始图像,所以我可以将其转换为jpg进行评分