Build An AI Image Generation Website in HTML CSS and JavaScript | Like Midjourney and DALL-E

Поделиться
HTML-код
  • Опубликовано: 16 май 2024
  • In this video, I've shown how to build an AI-powered Image Generation Website in HTML, CSS, and JavaScript. On this website, users enter their prompt and select a number of AI-generated images they want to be created. They can also download their images by clicking on the download button. This website is similar to MidJourney and DALL-E and works on all devices.
    Download Images only of this AI Image Generator Website
    www.codingnepalweb.com/custom...
    Hire me on Fiverr
    www.fiverr.com/prakashahi
    Follow me on Instagram
    / coding.np
    Visit my website for helpful coding projects with source code
    www.codingnepalweb.com
    Timestamps:
    0:00 AI Image Generator Demo
    2:00 Starting with HTML & CSS
    17:09 Getting Into JavaScript
    17:43 Creating Loading Cards
    21:18 Generating AI Images using API
    28:50 Downloading Image on Button Clicks
    #html #css #javascript #ai #openai #dalle #aiimagegenerator
    Music Credit:
    Ikson - We Are Free [Official]
    • #83 We Are Free (Offic...
    LAKEY INSPIRED - Chill Day
    • LAKEY INSPIRED - Chill...
    Miss You - LiQWYD
    • Miss You - LiQWYD (No ...
    After Rain - Zackross
    • After Rain - Zackross ...

Комментарии • 109

  • @tizianopreisig3094
    @tizianopreisig3094 7 месяцев назад +9

    Thank you so much for making this available on RUclips. You provide top-notch quality here. I'm a big fan of your videos.

  • @ascodes3461
    @ascodes3461 5 месяцев назад

    Thank you soo much for this amazing video 😍

  • @marginiszero
    @marginiszero 7 месяцев назад

    It is an amazing work bro ✌😍

  • @switchlyrics.
    @switchlyrics. 7 месяцев назад

    I always watch your tutorials

  • @Shaydon845
    @Shaydon845 7 месяцев назад +1

    instead of making a top blacklayer and making it adjust you can use filter: brightness(0.8) its works best

  • @mehdismaeili3743
    @mehdismaeili3743 7 месяцев назад

    Excellent.

  • @user-vj3dh6ok6o
    @user-vj3dh6ok6o 8 месяцев назад

    OMG It 's what I've been looking for :)

  • @gentlehandwithgreatsmile
    @gentlehandwithgreatsmile 3 месяца назад +1

    Really nice tutorial! thanks. to anyone having troubles with this project, add "model : 'dall-e-3'" and 'n:1' and google the sizes of dall-e-3 and choose your ideal. Then you will get an error, the "bill" error, which means you have to pay the API, otherwise you can't access it. Still it's amazing to know how to build an AI project with javascript.

    • @meghashah269
      @meghashah269 3 месяца назад

      I'm getting access limit error can you please guide me?

    • @studypoint3338
      @studypoint3338 4 дня назад

      @@meghashah269 did your error resolved

  • @JordanPCox
    @JordanPCox 4 месяца назад

    Thanks for doing this, love your work! I'm having a similar issue as others have shared with the API key I generated not working. From what I can gather, you have to subscribe to an OpenAI pricing plan in order to generate an API key as the free one is designated as a test key. Are you able to confirm if this is correct? Much appreciated!

  • @user-br5vo4ew3g
    @user-br5vo4ew3g 8 месяцев назад +1

    Instead of converting the response as a json we can directly make the response as a url and convert it into blob

  • @alaakouki4369
    @alaakouki4369 7 месяцев назад +4

    Sir, please could you explain how querySelector of download Btn still works (after generate AI images) after you although you already remove the download button from the initial showcase images (the main one from HTML) ?
    Or it is take it from imgCardMarkup ?

    • @featherphone9644
      @featherphone9644 Месяц назад +1

      because when you're generating images you generate const imgCardMarkup where the dwnload button is still present

  • @CC-1.
    @CC-1. 8 месяцев назад +10

    Oh it would be fun if you created your own actual AI modal just use an transformer with few billion or million images labeled easy as it sounds with libbs like tensor flow training is easy creating server and we got it

  • @mdms4549
    @mdms4549 8 месяцев назад

    Perfect job🎉🎉🎉 thanks 😊😊😊

  • @Jihad313m
    @Jihad313m 5 месяцев назад

    Thank you very much, but I have a question: how can I run dall.e3 in this same project

  • @bhuvandahal421
    @bhuvandahal421 8 месяцев назад

    wow amazing 🥰😍🤩

  • @zohramanzoor3473
    @zohramanzoor3473 8 месяцев назад +4

    COOL 😍😍BUT WHEN WILL YOU UPLOAD THE SOURCE CODE ON YOUR WEBSITE ?

    • @CodingNepal
      @CodingNepal  7 месяцев назад

      Here is the source code link: www.codingnepalweb.com/ai-image-generator-website-html-javascript/

  • @chikeziechinonso4671
    @chikeziechinonso4671 8 месяцев назад

    Amazing

  • @gbgb1
    @gbgb1 5 месяцев назад

    hey codingnepal tou can post payment method strip steb by step? how i can install npx init in Visual code idk

  • @CC-1.
    @CC-1. 8 месяцев назад +1

    First

  • @VedantBilaiya
    @VedantBilaiya 8 месяцев назад +1

    First 🥇
    Please pin because it is going to viral 😊

  • @reallife1482
    @reallife1482 7 месяцев назад

    Thank you so much 🥰❣️❣️❣️

  • @Nanda-mt4oe
    @Nanda-mt4oe Месяц назад +1

    Failed to generate AI images. make sure your API key is valid
    This is appearing even after i replace my API key 😢

  • @mahin_2_23
    @mahin_2_23 8 месяцев назад

    Please create a professional video editing app

  • @suriyar9462
    @suriyar9462 3 месяца назад

    This nice working perfectly and I want be like ai quiz generator website plz create the video for this website 🙏🏻

    • @darky8772
      @darky8772 3 месяца назад +1

      How can this work if all users get a message about an incorrect api key when they click the generation button?

  • @RaziqAbbas-hi2fe
    @RaziqAbbas-hi2fe 3 дня назад

    it is showing 400 bad request error on usage of API now what to do

  • @KARAN_RANA36
    @KARAN_RANA36 14 дней назад +2

    Status Code 400 () Bad request error show please explain about it ?

  • @arnoldfouenang5228
    @arnoldfouenang5228 6 месяцев назад +2

    i followed the tutorial but my code is not working "{
    "error": {
    "code": null,
    "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
    "param": null,
    "type": "invalid_request_error"
    }
    }" I've been stuck here since this morning, I can't move forward. Could I have a solution?

    • @sauravsharma5999
      @sauravsharma5999 6 месяцев назад +1

      yes got the same error! please tell if you have solved this😓

    • @ascodes3461
      @ascodes3461 5 месяцев назад +1

      use the word headers instead of header

    • @arthuralves515
      @arthuralves515 5 месяцев назад

      Did you manage to fix it?

    • @46_princesharma61
      @46_princesharma61 5 месяцев назад

      Yeah I have got the same error

    • @dudududu2147
      @dudududu2147 Месяц назад

      Do you have this code? pls give me! Thanks bro very much!

  • @wowinteractives8508
    @wowinteractives8508 6 месяцев назад

    tnx for the code - I can't make it working localy and on web serwer - I'v put my openai key, uploaded all files but always get error:" ..invalid key" - should I put anything on the serwer? How get it for visitors on my website?

  • @battlegroundgaming411
    @battlegroundgaming411 Месяц назад +1

    can you make same project using hugging face

  • @user-ph3kf2re5c
    @user-ph3kf2re5c 2 месяца назад

    how to solve unexpected token error?

  • @sujalnarkar1942
    @sujalnarkar1942 7 месяцев назад

    sir they are asking for api key

  • @kelwinanim4rt966
    @kelwinanim4rt966 Месяц назад +1

    could someone borrow me a api key? i'm not getting it work

  • @FLIMFLASH26
    @FLIMFLASH26 6 месяцев назад

    Sir why don't u explain what code use why u use ?

  • @kajalaroskar1987
    @kajalaroskar1987 5 месяцев назад +1

    {
    "error": {
    "code": null,
    "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
    "param": null,
    "type": "invalid_request_error"
    }
    }
    please help me with this error m not able to solve this error

    • @sauravsharma5999
      @sauravsharma5999 5 месяцев назад

      yes i am also stuck at this . please tell if you have solved this problem

    • @himanshubarapatre1335
      @himanshubarapatre1335 5 месяцев назад

      @@sauravsharma5999 anyone solved the error ?

    • @rubenvega8454
      @rubenvega8454 5 месяцев назад +1

      Anyone fix it?

    • @Nithish_kumar3
      @Nithish_kumar3 Месяц назад

      We have to pay for apikey then only we can access

  • @lumnaire_coding
    @lumnaire_coding 4 месяца назад

    {
    "error": {
    "code": "billing_hard_limit_reached",
    "message": "Billing hard limit has been reached",
    "param": null,
    "type": "invalid_request_error"
    }
    }
    help me fix

  • @vasimhubli2042
    @vasimhubli2042 2 месяца назад +1

    I added my api key, still not working.

    • @redxroomie
      @redxroomie 2 месяца назад +1

      Did you have limit in api key

  • @pritimodanwal06
    @pritimodanwal06 7 месяцев назад

    Hate it , Project is not working properly. I got stuck and give 2 days still issue not resolve. Not satisfied of this project code

    • @CodingNepal
      @CodingNepal  7 месяцев назад

      It works perfectly if you follow the steps properly. If you need source code, here it is: Here is the source code link: www.codingnepalweb.com/ai-image-generator-website-html-javascript/

    • @batuhanbayr7613
      @batuhanbayr7613 7 месяцев назад

      no its not ı am taking this error "{
      "error": {
      "code": null,
      "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
      "param": null,
      "type": "invalid_request_error"
      }
      }" and my code is "const generateForm = document.querySelector(".generate-form");
      const imageGallery = document.querySelector(".image-gallery");
      const OPENAI_API_KEY = "my_key";
      const updateImageCard = (imgDataArray) => {
      imgDataArray.forEach((imgObject, index) => {
      const imgCard = imageGallery.querySelectorAll(".img-card")[index];
      const imgElement = imgCard.querySelector("img");
      const aiGeneratedImg = `data:image/jpeg;base64,${imgObject.b64_json}`;
      imgElement.src = aiGeneratedImg;
      imgElement.onload = () => {
      imgCard.classList.remove("loading");
      }
      });
      }
      const generateAiImages = async (userPrompt, userImageQuantity) => {
      try{
      const response = await fetch("api.openai.com/v1/images/generations",{
      method: "POST",
      headers: {
      "Content-Type": "application/json",
      "Authorization": `Bearer ${OPENAI_API_KEY}`,
      },
      body: JSON.stringify({
      prompt: userPrompt,
      n: parseInt(userImageQuantity),
      size: "512x512",
      response_format: "b64_json"
      })
      });
      if(!response.ok) throw new Error("Failed to generate images! Please try again.");
      const { data } = await response.json();
      updateImageCard([...data]);
      } catch(error){
      alert(error.message);
      }
      }
      const handleFormSubmission = (e) => {
      e.preventDefault();
      const userPrompt = e.srcElement[0].value;
      const userImageQuantity = e.srcElement[1].value;
      const imgCardMarkup = Array.from({length: userImageQuantity}, () =>
      `




      `
      ).join("");
      imageGallery.innerHTML = imgCardMarkup;
      generateAiImages(userPrompt, userImageQuantity);
      }
      generateForm.addEventListener("submit", handleFormSubmission);
      "@@CodingNepal

    • @batuhanbayr7613
      @batuhanbayr7613 7 месяцев назад

      Did u find the solution? Pleade help me

  • @himanshubarapatre1335
    @himanshubarapatre1335 5 месяцев назад +1

    {
    "error": {
    "code": null,
    "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
    "param": null,
    "type": "invalid_request_error"
    }
    }
    anyone her solved this error?

    • @ascodes3461
      @ascodes3461 5 месяцев назад

      use the word headers instead of header

    • @arthuralves515
      @arthuralves515 5 месяцев назад

      Did you manage to fix it?

    • @himanshubarapatre1335
      @himanshubarapatre1335 5 месяцев назад

      can you tell where to change this@@ascodes3461

    • @rubenvega8454
      @rubenvega8454 5 месяцев назад

      Have yo managed to fix it?

  • @ThapeloMohapi-wu9su
    @ThapeloMohapi-wu9su 6 месяцев назад

    "Authorization": `Bearer ${OPENAI_API_KEY}` not working

    • @ascodes3461
      @ascodes3461 5 месяцев назад

      use the word headers instead of header

    • @46_princesharma61
      @46_princesharma61 5 месяцев назад

      ​@@ascodes3461bro this is not a solution

  • @minionsgaming5164
    @minionsgaming5164 4 месяца назад +1

    PLease help we are getting error of API KEY i have done all correct can you check once!!

  • @KhushiKumari-ff4eg
    @KhushiKumari-ff4eg 4 месяца назад

    did anyone got solution to this error {
    "error": {
    "code": null,
    "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
    "param": null,
    "type": "invalid_request_error"
    }
    }

    • @anavasconcelos7284
      @anavasconcelos7284 3 месяца назад

      Open ai has credit that you can use while in trial period. That means that your key is probably expired because your trial period has ended. You can pay credits to use it, but it may not be worth it since a lot of people are complaining the theres a problem with the system that checks the usage, and their keys often appear to consume the credit at an unrealisstic pace.

    • @siddhantgupta11
      @siddhantgupta11 2 часа назад

      have you resolved this issue??

  • @batuhanbayr7613
    @batuhanbayr7613 7 месяцев назад

    ı followed thhe tutorial but my code is not working "{
    "error": {
    "code": null,
    "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
    "param": null,
    "type": "invalid_request_error"
    }
    }" can somone help me please?

    • @CodingNepal
      @CodingNepal  7 месяцев назад

      Please double-check your API call to ensure that the request method is set to POST.

    • @batuhanbayr7613
      @batuhanbayr7613 7 месяцев назад

      @@CodingNepal type is POST

    • @chandan_mishra18
      @chandan_mishra18 7 месяцев назад

      Same error coming in my project..can you please test your code@@CodingNepal

    • @chandan_mishra18
      @chandan_mishra18 7 месяцев назад +1

      "{
      "error": {
      "code": null,
      "message": "Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)",
      "param": null,
      "type": "invalid_request_error"
      }
      }"@@CodingNepal

    • @arthuralves515
      @arthuralves515 5 месяцев назад

      Did you manage to fix it?@@chandan_mishra18

  • @moaliwindows11
    @moaliwindows11 8 месяцев назад

    hi

  • @user-no6cw6md4j
    @user-no6cw6md4j 5 месяцев назад +8

    Failed to generate AI images. Make sure your API key is valid. i am getting this issue

    • @sadiqahmed1529
      @sadiqahmed1529 3 месяца назад

      Have you got the result ??

    • @SambhavTiwari-ld9rp
      @SambhavTiwari-ld9rp 2 месяца назад

      Dealing with same problem

    • @Nithish_kumar3
      @Nithish_kumar3 Месяц назад

      I think we have to pay for apikey I have same issue

    • @Mars18542
      @Mars18542 13 дней назад

      Is your problem solved?

    • @igupta.vishal
      @igupta.vishal 9 дней назад

      Bcz you have not placed your openai API in script.js or either it's API got paid now days

  • @maksymkaraszewski7467
    @maksymkaraszewski7467 Месяц назад +1

    im getting "bad request" error whenever i try to generate images. i havent found a fix yet if anyone has the same problem and found the solution please let me know

  • @SambhavTiwari-ld9rp
    @SambhavTiwari-ld9rp 2 месяца назад

    Need valid key 🗝️

  • @dudududu2147
    @dudududu2147 Месяц назад +1

    Who has this code, pls tell me! Thanks very much!

  • @jaiprakashshah7892
    @jaiprakashshah7892 2 дня назад

    need help

  • @vasimhubli2042
    @vasimhubli2042 2 месяца назад +1

    The api is paid😢

  • @user-vl9im6ck9y
    @user-vl9im6ck9y 3 месяца назад +1

    Have a problem with FETCH!!!
    error 400
    "message": "Additional properties are not allowed ('promt' was unexpected)"
    "type": "invalid_request_error"

  • @flosrv3194
    @flosrv3194 10 дней назад

    Undoable. at 18:31 nothing works errror 404 and i verified all the fucking code

  • @Asliddin_Mlbb
    @Asliddin_Mlbb 4 месяца назад

    fake it