Stable Diffusion shocked the world when it was released free of charge, allowing AI to generate very high quality illustrations and photos at tremendous speed.
Technology is changing the world.
It is easy to imagine that these trends will not stop at image generation, but will expand to audio, video, and 3D models.
As a test, I also ran Stable Diffusion to generate an image. Here are some of the results
Isn't this fantastic technology?
We should incorporate this technology into games and apps.
In this article, I will show you how to run Stable Diffusion on Google Colaboratory so that you can use this technology for free.
For more technical details on Stable Diffusion, this article is a good reference for those interested.
Table Of Content
Sign up for Hugging Face
You need an authentication token to run Stable Diffusion, so first create your account at Hugging Face.
Fill in the required fields to proceed with the creation of your account.
Display the mailer you normally use to verify your email address.
Then, go to the Settings section from your account.
Go to Settings > Access Token and click the New Token button.
Furthermore, click on the Generate Token button and the token is ready.
HuggingFace is now ready.
Run Stable Diffusion for free with Google Colaboratory
Next, let's prepare for Stable Diffusion.
Stable Diffusion requires python and a GPU to run, but Google Colaboratory allows you to use Stable Diffusion even if your PC has low specs.
Visit Google Colaboratory Link above to create a duplicate on your Google Drive.
Paste the token created by HuggingFace.
Run it to complete the setup. Then allow access to Google Drive.
Visit your Google Drive MyDrive and create a folder named googleColab.
If you want to change the name of the output folder to any name, modify the following part of the Python code.
drive_path = "/content/gdrive/MyDrive/googleColab/"
Change the prompt_text in the block below to a string of your choice and execute.
Wait a few minutes and the image will be generated as shown below, and the image file will be saved to Google Drive as well.
Now you have successfully generated an image with Stable Diffusion.
Now, let's generate images all over the place!
Tips for generating quality images
After running Stable Diffusion many times, the images' quality may not be that high.
In such a case, let's check what kind of prompts can be used to generate high-quality images.
You can search for images on the Lexica website and examine the Prompt that generated them.
I encourage you to use AI image generation for your activities.
Run Stable Diffusion on Google Colaboratory for free and use it in your game development!
How was it?
It's great to harness the power of the GPU for free with Google Colaboratory.
Please let me know if you use this article to release a game or app that uses images generated by Stable Diffusion.
I wish you the best of luck with your project.