scrimba
Dall-E & GPT Vision
Image generation challenge solution
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Image generation challenge solution
AboutCommentsNotes
Image generation challenge solution
Expand for more info
index.js
run
preview
console
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
dangerouslyAllowBrowser: true,
});

const form = document.querySelector("#posterForm");
const movieTitle = document.querySelector("#movie-title");
const artStyles = document.querySelector("#art-styles");
const posterOutput = document.querySelector("#poster-output");

/*
Image generation project requirements:
- Create a prompt from the movie title and art style submitted by the user
- Use the image generations endpoint to provide `dall-e-3`
or `dall-e-2` the prompt created by the form submission
- Display the final poster image within the `posterOutput` div

Stretch goals:
- On submit, display text describing the image being generated
- Provide user feedback when any errors occur
*/

form.addEventListener("submit", function (event) {
event.preventDefault();
form.reset();
});

async function generatePoster() {

}
Console
/index.html
-6:33