Канал про Data Science и BigData.
Для связи: @ermakovpetr
Post #183
2.94K

Вряд ли в трамваях ESM поддержка)
- 😁 8
- 🔥 4
- 🥴 3
- 👍 1
DA @powerofdata
Showing posts older than #184 · Back to latest

Forwarded from gonzo-обзоры ML статей
> spotlight.show(df)


Forwarded from Yandex for Developers

Forwarded from ODS Events
import PIL
import base64
import io
import requests
import time
text = "комикс игра престолов"
wtf = '----WebKitFormBoundarywlnxcaZpV1ghiA4E'
cdfdn = '\r\nContent-Disposition: form-data; name='
api_url = 'https://fusionbrain.ai/api/v1/text2image'
api_url_run = api_url + '/run'
api_url_pockets = api_url + '/generate/pockets/'
data = (f'--{wtf}{cdfdn}"queueType"\r\n\r\ngenerate\r\n--{wtf}' +
f'{cdfdn}"query"\r\n\r\n{text}\r\n--{wtf}' +
f'{cdfdn}"preset"\r\n\r\n1\r\n--{wtf}' +
f'{cdfdn}"style"\r\n\r\n\r\n--{wtf}--\r\n').encode()
response = requests.post(api_url_run, headers={'Content-Type': f'multipart/form-data; boundary={wtf}'}, data=data)
pocket = response.json()['result']['pocketId']
time.sleep(3)
response = requests.get(api_url_pockets + f"{pocket}/status",
headers={'Content-Type': f'multipart/form-data; boundary={wtf}'},
)
while response.json()['result'] != 'SUCCESS':
print(response.json()['result'])
time.sleep(3)
response = requests.get(api_url_pockets + f"{pocket}/status")
response = requests.get(api_url_pockets + f"{pocket}/entities")
msg = base64.b64decode(response.json()['result'][0]['response'][0])
buf = io.BytesIO(msg)
img = PIL.Image.open(buf)
img

Forwarded from Как мы делаем Яндекс
