import requests
import json
X_RapidAPI_Key = '4116843d07msh704be0dfa337826p108b3fjsn72323’
X_RapidAPI_Host = ‘colorize-photo1.p.rapidapi.com’
headers = = {
“X-RapidAPI-Key”: X_RapidAPI_Key,
“X-RapidAPI-Host”: X_RapidAPI_Host
}
url = “https://” + X_RapidAPI_Host + “/generate_image_prompt”
files = {
‘image’: (‘test.jpg’, open(’./test.jpg’, ‘rb’), ‘image/jpeg’)
}
data = {
“standard_filter_id”: “0”, # 1-20, 0 is disabled
"artistic_filter_id": “0”, # 1-100, 0 is disabled
"all_standard_filters": “true”, # return all 20 prompts
"all_artistic_filters": “false”, # return all 100 prompts
"raw_captions": “false” # remove pre and post fix to the caption
}
response = requests.post(url, files=files, data=data, headers=headers)
prompts = data = json.loads(response.text)