我目前正在使用 Kairos API,并尝试使用 Pythonista 在我的 iPad 上拍摄一张新照片,然后将该照片上传到 Kairos 注册 API。我可以让它与 URL 图像一起正常工作,但对于我的生活,我无法通过使用照片模块拍照来让它工作。据我了解,照片模块返回一个 PIL 图像,我认为我需要在上传到 Kairos API 之前对其进行 base64 编码?
这是我不使用照片模块的代码:
#import photos
import requests
#img = photos.capture_image()
url = "https://api.kairos.com/enroll"
values = """
{
"image": "https://images.pexels.com/photos/614810/pexels-photo-614810.jpeg?cs=srgb&dl=face-facial-hair-fine-looking-614810.jpg&fm=jpg",
"subject_id": "test",
"gallery_name": "test"
}
"""
headers = {
'Content-Type': 'application/json',
'app_id': '********',
'app_key': '************************'
}
request = requests.post(url, data=values, headers=headers)
response = request.content
print(response)
我希望有人可以帮助我,向我展示我需要做什么才能完成这项任务。任何帮助是极大的赞赏。
先感谢您,
科林