This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://beta.openai.com/docs/guides/images/language-specific-tips | |
#https://beta.openai.com/docs/api-reference/introduction | |
#POST - https://api.openai.com/v1/images/variations | |
#The image variations endpoint allows you to generate a variation of a given image. | |
#https://beta.openai.com/docs/guides/images/usage | |
#https://beta.openai.com/docs/guides/images | |
Creates a variation of a given image. | |
#pip install openai | |
from google.colab import files | |
files.upload() | |
from PIL import Image | |
from PIL import ImageOps | |
image = Image.open("3.jpg").convert("RGB") | |
ImageOps.pad(image,(512,512)).save('3.png') | |
import os | |
import openai | |
openai.api_key = "pleasefillasperyourdata" | |
response = openai.Completion.create( | |
model="text-davinci-003", | |
prompt="", | |
temperature=0.7, | |
max_tokens=256, | |
top_p=1, | |
frequency_penalty=0, | |
presence_penalty=0 | |
) | |
response = openai.Image.create_variation( | |
image=open("3.png", "rb"), | |
n=10, | |
size="512x512" | |
) | |
image_url = response['data'][0]['url'] | |
#InvalidRequestError: Uploaded image must be a PNG and less than 4 MB. | |
#InvalidRequestError: '600x600' is not one of ['256x256', '512x512', '1024x1024'] - 'size' | |
#InvalidRequestError: Invalid input image - expected an image with equal width and height, got 1600x1200 instead. | |
print(image_url) | |
Very Realistic, New variations!!!
Keep Exploring!!!
No comments:
Post a Comment