Skip to content

Eyelor/text-to-image-item-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TEXT-TO-IMAGE-ITEM-GENERATOR

Words to Images: Instantly.

Built with the tools and technologies:

Python Conda PyTorch CUDA HuggingFace


Table of Contents


Overview

This project generates unique product images from randomly generated names. Using AI, it combines text-to-image generation with a streamlined workflow, creating novel visuals for marketing, design, or creative exploration. Ideal for designers, marketers, or anyone needing quick, visually appealing product mockups.





Features

Feature Summary
⚙️ Architecture
  • The project uses a two-stage architecture: first, a large language model generates a product name; second, a diffusion model generates an image based on that name.
  • The system relies on pre-trained models for both text and image generation, indicating a reliance on existing, powerful models rather than training new ones from scratch.
  • The main.py file orchestrates the interaction between the language model and the diffusion model.
  • Random seed generation ensures variability in output images for the same input text.
🔌 Integrations
  • The project integrates Hugging Face Hub libraries (transformers and diffusers), indicating the use of pre-trained models from the Hugging Face ecosystem.
  • It leverages PyTorch and CUDA for efficient deep learning computations, specifically utilizing version 11.8 of CUDA.

Project Structure

└── text-to-image-item-generator/
    ├── environment.yml
    ├── main.py
    ├── nice_images_generated
    └── pytorch-check.py

Project Index

TEXT-TO-IMAGE-ITEM-GENERATOR/
__root__
environment.yml - environment.yml specifies the project's Python environment, ensuring reproducibility
- It defines necessary packages for text-to-image generation, including PyTorch with CUDA 11.8 support, Hugging Face libraries (Transformers, Diffusers), and related dependencies
- This file facilitates consistent setup across different machines, enabling seamless execution of the text-to-image generation application.
main.py - The program generates a short, random product name using a large language model
- It then leverages a diffusion model to create and display an image based on this generated name
- The process incorporates random seed generation for variability and utilizes a pre-trained model for both text and image generation, offering a streamlined workflow for creative content generation.
pytorch-check.py - Pytorch-check.py verifies PyTorch and CUDA installations
- It reports the PyTorch version, CUDA version used during PyTorch's build, and CUDA availability
- This pre-flight check ensures the necessary deep learning dependencies are correctly configured before executing the main application, preventing runtime errors.

Getting Started

Prerequisites

Before getting started with text-to-image-item-generator, ensure your runtime environment meets the following requirements:

  • Programming Language: Python 3.11
  • Package Manager: Conda
  • Architecture: CUDA 11.8 (You can find different architectures and versions on the official PyTorch website - check main.py comments for links)
  • Disk Space: ~60GB - local models and environment dependencies + a few GB for necessary tools

Installation

Install text-to-image-item-generator using the following method:

  1. Clone the text-to-image-item-generator repository:
git clone https://github.com/Eyelor/text-to-image-item-generator
  1. Navigate to the project directory:
cd text-to-image-item-generator
  1. Install the project dependencies:

Before doing this, you can check which architecture is best for your GPU or CPU. In my case, for the RTX 20xx series, CUDA 11.8 was the best choice. Do your research to find the right architecture for your hardware and choose compatible versions for other dependencies accordingly in the environment.yml file.

Using conda

conda env create -f environment.yml

Usage

Run text-to-image-item-generator using the following commands:

Using conda

conda activate text-to-image-item-generator_env

Using python

python main.py

If something is not working properly, check the files for comments.

Testing

Run the configuration test using the following command:

Using python

python pytorch-check.py

Based on the response from this test, you can see which versions of PyTorch and CUDA you are using and whether they are available.


License

This project is protected under the Apache 2.0 License. For more details, refer to the LICENSE file.


About

A Python workflow for generating random item images using models from Hugging Face.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages