Etsa Memes
Mohlaleng ona re tla sheba mokhoa oa ho etsa li-memes u sebelisa li- Predis.ai API. Re tla beha boleng ba post_type ho meme le boleng ba media_type parameter ho single_image. Hajoale feela single_image e tšehetsoa bakeng sa ho hlahisa li-meme ka hona boleng bo bong ho media_type tla hloleha.
U ka fana ka sehlooho / mohopolo oa meme ho text paramente.
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))
Haeba u fumana file ea inProgress boemo ha u arabela, kopo ea hau e atlehile 'me meme e ntse e hlahisoa. Hang ha meme e hlahisoa ka katleho (kapa e hloleha), o tla fumana kopo ho URL ea hau ea webhook e nang le lintlha tse ling.