This project is a simple, yet powerful, text-to-image generator built using the Hugging Face Diffusers library and Google Colab. It allows users to create high-quality images from text prompts using the Stable Diffusion model.
- Easy Setup: All dependencies are installed directly within the notebook.
- Secure Authentication: Uses Google Colab's built-in secrets manager to securely handle your Hugging Face token.
- GPU Accelerated: Leverages Google Colab's T4 GPU for fast image generation.
- Interactive: Prompts the user for a text description to generate a unique image.
To run this project, you will need a Google account and a Hugging Face account.
- A Google Account to access Google Colab.
- A Hugging Face Account to get an access token.
-
Open the Notebook in Colab: Click the "Open in Colab" badge at the top of the notebook file on GitHub.
-
Get Your Hugging Face Token:
- Log in to your Hugging Face account.
- Navigate to Settings > Access Tokens.
- Create a new token with a
ReadorFine-grainedrole (andInferencepermissions if using the latter). - Copy your new token.
-
Store the Token as a Colab Secret:
- In the Colab notebook, click the ๐ icon on the left-hand side to open the Secrets panel.
- Click "Add new secret."
- For the Name, use
HF_TOKEN. For the Value, paste the token you just copied. - Ensure "Notebook access" is toggled on.
-
Run the Notebook:
- Run all the cells in the notebook (
Runtime > Run all). - The notebook will install the necessary libraries and load the Stable Diffusion model.
- When prompted, enter your image description, and the generator will produce an image for you!
- Run all the cells in the notebook (
Text_to_Image_Generator.ipynb: The main Colab notebook containing all the code.README.md: This file, which provides an overview of the project.
This is a simple project, but contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request.