Colorize Photo

FREEMIUM
Par Palette AI | Mise à jour hace 2 meses | Artificial Intelligence/Machine Learning
Popularité

9.3 / 10

Latence

949ms

Niveau de service

99%

Health Check

100%

Retour à tous les tutoriels (4)

Simple snippet to colorize one image with defaults (Python)

import requests

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 + /colorize_image_with_auto_prompt"
files = {‘image’: (‘black_and_white.jpg’, open(’ ./black_and_white.jpg’, ‘rb’), ‘image/jpeg’ )}
headers = {“X-BLOBR-KEY”: “”}
response = requests.post(url, files=files, headers=headers)
f = open( ‘colorized_image.jpg’, ‘wb’ )
f.write(response.content)
f.close()