2017-11-11 117 views
1

我使用sightengine API來檢測圖像中的兒童性虐待。爲了做到這一點,我試圖使用sightengine API檢測圖像中的裸露級別。以下示例在文檔本身中提供。使用sightengine api時'檢查'對象沒有屬性'圖像'

from sightengine.client import SightengineClient 

client = SightengineClient('api_user', 'api_key') 
output = client.check('nudity').image('https://d3m9459r9kwism.cloudfront.net/img/examples/example7.jpg') 

除了複製相同的代碼,我收到以下錯誤。

Traceback (most recent call last): 
    File "driver.py", line 3, in <module> 
    output = client.check('nudity').image('https://d3m9459r9kwism.cloudfront.net/img/examples/example7.jpg') 
AttributeError: 'Check' object has no attribute 'image' 

我已經使用了Python 2和Python 3的相同的代碼,但都提出了相同的錯誤。

回答

1

試試這個:

from sightengine.client import SightengineClient 

client = SightengineClient('API user', 'API secret') 

checkNudity = client.check('nudity') 

output1 = checkNudity.set_url('https://d3m9459r9kwism.cloudfront.net/img/examples/example7.jpg') 

print(output1)