Created
November 6, 2022 10:03
-
-
Save lorenzojkrl/ddfa7dc43b3f196a0c7c7a4486267fa3 to your computer and use it in GitHub Desktop.
DALLE - Initial code for React image generation app using openai API
This file contains hidden or 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
function App() { | |
const [userPrompt, setUserPrompt] = useState("") | |
const [imageUrl, setImageUrl] = useState("") | |
return ( | |
<div className="App"> | |
{ | |
imageUrl | |
? <img src={imageUrl} className="image" alt="ai thing" /> | |
: <img src={logo} className="image" alt="logo" /> | |
} | |
<p>Generate a unique image using DALL·E</p> | |
<p>What do you want to see?</p> | |
<input | |
placeholder='A sunset on the Sydney Opera House' | |
onChange={(e) => setUserPrompt(e.target.value)} | |
/> | |
<button>Generate</button> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment