854
订阅者
无数据24 小时
-127 天
-4530 天
帖子存档
854
from openai import OpenAI
client = OpenAI()
response = client.images.generate(
model="dall-e-3",
prompt="a white siamese cat",
size="1024x1024",
quality="standard",
n=1,
)
print(response.data[0].url)
from openai import OpenAI
client = OpenAI()
response = client.images.edit(
model="dall-e-2",
image=open("sunlit_lounge.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A sunlit indoor lounge area with a pool containing a flamingo",
n=1,
size="1024x1024",
)
print(response.data[0].url)
from openai import OpenAI
client = OpenAI()
response = client.images.create_variation(
model="dall-e-2",
image=open("corgi_and_cat_paw.png", "rb"),
n=1,
size="1024x1024"
)
print(response.data[0].url)
import OpenAI from "openai";
const openai = new OpenAI();
// This is the Buffer object that contains your image data
const buffer = [your image data];
// Set a
name that ends with .png so that the API knows it's a PNG image
buffer.name = "image.png";
async function main() {
const image = await openai.images.createVariation({ model: "dall-e-2", image: buffer, n: 1, size: "1024x1024" });
console.log(image.data);
}
main();
import fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
// Cast the ReadStream to any to appease the TypeScript compiler
const image = await openai.images.createVariation({
image: fs.createReadStream("image.png") as any,
});
console.log(image.data);
}
main();
import fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI();
// This is the Buffer object that contains your image data
const buffer: Buffer = [your image data];
// Cast the buffer to any so that we can set the name property
const file: any = buffer;
// Set a name that ends with .png so that the API knows it's a PNG image
file.name = "image.png";
async function main() {
const image = await openai.images.createVariation({
file,
1,
"1024x1024"
});
console.log(image.data);
}
main();
import fs from "fs";
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
try {
const image = await openai.images.createVariation({
image: fs.createReadStream("image.png"),
n: 1,
size: "1024x1024",
});
console.log(image.data);
} catch (error) {
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
}
}
main();854
My intro is I’m a full time Degen but my graduation was in ai and machine learning so in this ai hype I was working on this product from past 2 months
