Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import requests
import json
from PIL import Image
from io import BytesIO


url="https://vogue.gjstatic.nl/thumbnails/GenjArticleBundle/Article/fileUpload/detail/00/79/31/angelina-jolie-komt-met-haar-eerste-statement-sinds-de-scheiding-met-brad-pitt-bekend-werd-7931.jpg"
response = requests.get(url)
img = Image.open(BytesIO(response.content))

r  = requests.post("https://api.haystack.ai/api/image/analyze?output=json&apikey=87bf2771ec002f6bc164a80838df4f61", data=response.content)
parsed = json.loads(r.text)
print(json.dumps(parsed, indent=4, sort_keys=True))