ML_Demo.mp4
📝 Contents
- Introduction
- Technology Stack
- Features
- Project Structure
- How to Run
- Using the Model
- Contribution Guidelines
- Get in Touch
This project implements a Text-to-Image Generation Model using TensorFlow and Gradio. The model converts textual descriptions (prompts) into corresponding images by identifying and generating captions for similar images from a dataset.
- TensorFlow: For deep learning and model training.
- Gradio: For creating the web-based interface.
- Pandas: For data manipulation and analysis.
- Numpy: For numerical operations.
- PIL: For image processing.
- COCO Dataset: Used for training and testing the model.
- Image Captioning: Generate captions for images using a Transformer-based model.
- Text-to-Image Matching: Find and display images that match a given textual prompt.
- Interactive Web Interface: Use Gradio to interact with the model and visualize results.
- Model Training and Saving: Train the model on a subset of the COCO dataset and save the weights.
coco_dataset/
: Directory containing the COCO dataset.annotations/captions_train2017.json
: Annotations for training data.train2017/
: Directory containing the training images.
captions_sample.csv
: Sampled captions and image paths used for training.vocab_coco.file
: Serialized vocabulary file created from the tokenizer.model.weights.h5
: File containing the saved weights of the trained model.Text-to-Image-Generation.ipynb
: Jupyter Notebook containing the code for this project.
-
Clone the repository:
git clone https://github.com/OKihichak/image_from_text_generation.git cd text-to-image-generator
-
Install the required dependencies:
pip install tensorflow pandas numpy matplotlib pillow tqdm requests scikit-learn gradio
-
Prepare the COCO dataset:
- Download and place the COCO dataset in the
coco_dataset/
directory.
- Download and place the COCO dataset in the
-
Run the Jupyter Notebook:
- Open
Text-to-Image-Generation.ipynb
and run the cells sequentially.
- Open
-
Generate Images from Text Prompts:
- Input a text prompt into the Gradio interface.
- The model will find the most similar image and display it along with a generated caption.
-
Save or Load Model Weights:
- Train the model and save the weights to
model.weights.h5
. - Load saved weights for further training or inference.
- Train the model and save the weights to
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/YourFeatureName
- Make your changes and commit them:
git commit -m 'Add YourFeatureName'
- Push to the branch:
git push origin feature/YourFeatureName
- Open a pull request to discuss and merge your changes.
- Email: [email protected]
- GitHub: Oleh Kihichak