1
我想上傳一個圖像的實例到faceplusplus api。如果我從驅動器或URL上傳圖像,但是當我使用圖像的實例時出現錯誤,則一切正常。以下是我的代碼如下。Python Faceplusplus API
import image
import requests
import StringIO
from facepp import API, File
url = "http://blogs.reuters.com/great-debate/files/2013/07/obama-best.jpg"
response = requests.get(url)
img = Image.open(StringIO(response.content))
result = api.detection.detect(img = File(img), mode = 'normal')
由於使用Google App Engine,我必須從url創建一個圖像實例。我應該使用什麼方法將圖像上傳到Faceplusplus API?
這裏是我的錯誤: 類型錯誤:強迫爲Unicode:需要字符串或緩衝區,如發現
你的幫助是非常讚賞。
謝謝!