Waihanga Memes
I tenei tauira ka titiro tatou me pehea te hanga meme ma te whakamahi i te Predis.ai API. Ka whakatauhia e matou te uara o post_type Tuhinga o mua meme me te uara o media_type tawhā ki single_image. I tenei wa anake single_image e tautokohia ana mo te whakaputa meme, na reira etahi atu uara i roto media_type ka taka.
Ka taea e koe te whakarato i te kaupapa/whakaaro mo te meme i roto i te text tawhā.
import requests, json
url = "https://brain.predis.ai/predis_api/v1/create_content/"
payload = {
"brand_id": "YOUR_BRAND_ID",
"text": "Me trying to prioritize work over sleep",
"media_type": "single_image",
"template_ids": json.dumps(["TEMPLATE_ID_1"]), # pass template_ids if you want to use a particular meme template
"post_type": "meme",
"model_version": "2", # memes not supported by model_version 4
}
headers = {"Authorization": "YOUR_API_KEY"}
response = requests.request("POST", url, data=payload, headers=headers)
if response.status_code == 200:
json_response = response.json()
post_id = json_response.get("post_id")
post_status = json_response.get("status")
else:
print("Error occurred - {}".format(response.text))
Mena ka whiwhi koe i te inProgress mana ki te whakautu, kua angitu to tono, kei te hanga te meme. Ina oti pai te hanga o te meme (ka rahua ranei), ka whiwhi koe i te tono ki to URL hook tukutuku kua whirihorahia me etahi atu korero.