Theha liposo ka ho sebelisa litšoantšo / livideo tsa hau
Mohlaleng ona re tla sheba mokhoa oa ho etsa li-post u sebelisa litšoantšo le livideo tsa basebelisi ho fapana le litšoantšo / livideo tse khothalelitsoeng ke AI. Re tla feta media_urls paramethara joalo ka lethathamo le nang le li-URL tsa litšoantšo/lifitio tse fumanehang phatlalatsa.
If media_urls e na le li-URL tsa livideo le media_type e behiloe ho efe kapa efe single_image or carousel, ebe li-URL tse tsoang ho media_urls e tla hlokomolohuoa 'me litšoantšo tse khothalelitsoeng tsa AI li tla sebelisoa.
import requests, json
url = "https://brain.predis.ai/predis_api/v1/create_content/"
payload = {
"brand_id": "YOUR_BRAND_ID",
"text": "3 tips for a healthy morning breakfast",
"media_type": "carousel",
"media_urls": json.dumps(["MEDIA_URL_1", "MEDIA_URL_2"]),
"model_version": "2", # media_urls 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 li-post li ntse li hlahisoa. Hang ha lipehelo li hlahisoa ka katleho (kapa li hloleha), u tla fumana kopo ho URL ea hau ea webhook e nang le lintlha tse ling mabapi le lipapatso. Tabeng ea li-post tse ngata, u tla fumana ketsahalo ea webhook bakeng sa poso ka 'ngoe ka thoko.