diff --git a/README.md b/README.md index b793f5c..2246eff 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,12 @@ This is a simple image generator using [OpenAI API](https://openai.com/api/). yo ## How to use -- type a short description of the image or a keyword -- click on the generate button and wait 3-5 seconds for the images to load -- you will get 3 images generated by the API +- Enter your OpenAI API key +- Enter a short description of the image or a keyword +- Select image size +- Select number of images +- Click on generate button +- Double click on the image to download it ## API Reference @@ -54,4 +57,4 @@ Open `index.html` in your browser ## License -[MIT](https://github.com/sauravhathi/image-generator-using-openai-api/blob/master/LICENSE) +[MIT](https://github.com/sauravhathi/image-generator-using-openai-api/blob/master/LICENSE) \ No newline at end of file diff --git a/index.html b/index.html index b30c7f9..1d14e8b 100644 --- a/index.html +++ b/index.html @@ -1,114 +1,197 @@ - - - - - - - Image Gererator using OpenAI API - - - -
-
-

Image Generator

-

- This is a simple image generator using - OpenAI API. - you can generate images by entering short description of the image or - by entering a keyword. -

+ + + + + + + + + Image Gererator using OpenAI API + + + +
+
+

Image Generator

+

+ This is a simple image generator using + OpenAI API. + You can generate images by entering a short description of the image or by entering a keyword. +

+
+
+
+ + + + + + + +
-
- - +
+
-
- + +
- - - + sizeSelect.addEventListener("change", function () { + imageSizes = sizeSelect.value; + }); + + numImagesSelect.addEventListener("change", function () { + numImages = parseInt(numImagesSelect.value); + }); + + btn.addEventListener("click", generateImage); + + function downloadImage(url) { + const link = document.createElement("a"); + link.href = url; + link.download = document.getElementById("text").value.split(" ").join("_") + ".png"; + link.target = "_blank"; + link.click(); + } + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..fe4b357 --- /dev/null +++ b/style.css @@ -0,0 +1,29 @@ +.input-style { + border: 2px solid #ccc; + border-radius: 0.25rem; + padding: 0.5rem; + color: #666; + background-color: #fff; + width: 100%; + outline: none; +} + +.button-style { + background-color: #eee; + color: #111; + font-weight: bold; + padding: 0.5rem 1rem; + border-radius: 0.25rem; + outline: none; + transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease; +} + +.button-style:hover { + background-color: #111; + color: #fff; + transform: translateY(-1px); +} + +.button-style:focus { + outline: none; +} \ No newline at end of file