---
title: Pepe Meme Generator
emoji: ๐ธ
colorFrom: green
colorTo: blue
sdk: streamlit
sdk_version: 1.31.0
app_file: src/app.py
python_version: "3.11"
---
# ๐ธ Pepe the Frog AI Meme Generator
### Create custom Pepe memes using AI-powered Stable Diffusion with LoRA fine-tuning
[](https://www.python.org/downloads/)
[](https://streamlit.io)
[](https://opensource.org/licenses/MIT)
[](https://huggingface.co/MJaheen/Pepe_The_Frog_model_v1_lora)
[Demo](https://huggingface.co/spaces/MJaheen/Pepe-Meme-Generator) โข [Documentation](./docs/) โข [Training Guide](./docs/TRAINING.md) โข [Report Bug](https://github.com/MJaheen/-Pepe-Meme-Generator-/issues)
---
## ๐ Table of Contents
- [Features](#-features)
- [Quick Start](#-quick-start)
- [Installation](#-installation)
- [Usage](#-usage)
- [Model Information](#-model-information)
- [Project Structure](#-project-structure)
- [Training](#-training-your-own-model)
- [Contributing](#-contributing)
- [License](#-license)
- [Acknowledgments](#-acknowledgments)
- [Contact & Support](#-contact--support)
---
## โจ Features
### ๐จ **Multiple AI Models**
- **Pepe Fine-tuned LoRA** - Custom trained on Pepe dataset (1600 steps)
- **Pepe + LCM (FAST)** - 8x faster generation with LCM technology
- **Tiny SD** - Lightweight model for faster CPU generation
- **Small SD** - Balanced speed and quality
- **Base SD 1.5** - Standard Stable Diffusion
- **Dreamlike Photoreal 2.0** - Photorealistic style
- **Openjourney v4** - Artistic Midjourney-inspired style
### โก **Performance Features**
- **LCM Support**: Generate images in 6 steps (~30 seconds on CPU)
- **GPU Acceleration**: Automatic CUDA detection with xformers support
- **Memory Efficient**: Attention slicing and VAE slicing enabled
### ๐ญ **Generation Features**
- **Style Presets**: Happy, sad, smug, angry, crying, and more
- **Raw Prompt Mode**: Use exact prompts without automatic enhancements
- **Text Overlays**: Add meme text with Impact font
- **Batch Generation**: Create multiple variations
- **Progress Tracking**: Real-time generation progress bar
- **Seed Control**: Reproducible generations with fixed seeds
- **Gallery System**: View and manage all generated memes
### ๐ฏ **User Experience**
- **Model Hot-Swapping**: Switch models without restart
- **Interactive UI**: Clean Streamlit interface
- **Example Prompts**: Built-in inspiration gallery
- **Download Support**: Save images with one click
- **Responsive Design**: Works on desktop and mobile
---
## ๐ Quick Start
### Try Online (No Installation)
๐ **[Open in Hugging Face Spaces](https://huggingface.co/spaces/MJaheen/Pepe-Meme-Generator)** - Run instantly in your browser!
### Local Installation
```bash
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/pepe-meme-generator.git
cd pepe-meme-generator
# 2. Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run the app
streamlit run src/app.py
```
The app will open in your browser at `http://localhost:8501`
---
## ๐ฆ Installation
### System Requirements
- **Python**: 3.10 or higher
- **RAM**: 8GB minimum, 16GB recommended
- **GPU**: Optional (NVIDIA with CUDA for faster generation)
- **Storage**: ~5GB for models and dependencies
### Dependencies
```bash
# Core dependencies
pip install torch torchvision # PyTorch
pip install diffusers transformers accelerate # Diffusion models
pip install streamlit # Web interface
pip install pillow numpy scipy # Image processing
pip install peft safetensors # LoRA support
```
Or install everything at once:
```bash
pip install -r requirements.txt
```
### GPU Setup (Optional but Recommended)
For NVIDIA GPUs with CUDA:
```bash
# Install PyTorch with CUDA support
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
# Install xformers for memory-efficient attention
pip install xformers
```
---
## ๐ฎ Usage
### Basic Usage
1. **Select a Model**: Choose from the dropdown (try "Pepe + LCM (FAST)" for speed)
2. **Enter a Prompt**: e.g., "pepe the frog as a wizard casting spells"
3. **Adjust Settings**: Steps (6 for LCM, 25 for normal), guidance scale, etc.
4. **Generate**: Click "Generate Meme" and wait
5. **Download**: Save your creation!
### Example Prompts
```
pepe_style_frog, wizard casting magical spells, detailed
pepe_style_frog, programmer coding on laptop, cyberpunk style
pepe_style_frog, drinking coffee at sunrise, peaceful
pepe_style_frog, wearing sunglasses, smug expression
pepe_style_frog, crying with rain, emotional, dramatic lighting
```
### Advanced Features
#### **Using LCM for Fast Generation**
1. Select "Pepe + LCM (FAST)" model
2. Use 6 steps (optimal for LCM)
3. Set guidance scale to 1.5
4. Generate in ~30 seconds!
#### **Adding Text Overlays**
1. Expand "Add Text" section
2. Enter top and bottom text
3. Text automatically styled in Impact font
4. Signature "MJ" added to corner
#### **Reproducible Generations**
1. Enable "Fixed Seed" in Advanced Settings
2. Set a seed number (e.g., 42)
3. Same seed + prompt = same image
---
## ๐ค Model Information
### Fine-Tuned LoRA Model
**Model ID**: `MJaheen/Pepe_The_Frog_model_v1_lora`
**Training Details**:
- **Base Model**: Stable Diffusion v1.5
- **Method**: LoRA (Low-Rank Adaptation)
- **Dataset**: [iresidentevil/pepe_the_frog](https://huggingface.co/datasets/iresidentevil/pepe_the_frog)
- **Training Steps**: 2000
- **Resolution**: 512x512
- **Batch Size**: 1 (4 gradient accumulation)
- **Learning Rate**: 1e-4 (cosine schedule)
- **LoRA Rank**: 16
- **Precision**: Mixed FP16
- **Trigger Word**: `pepe_style_frog`
**Performance**:
- Quality: โญโญโญ (Good)
- Speed (CPU): ~4 minutes (25 steps)
- Speed (GPU): ~15 seconds (25 steps)
---
## ๐ Project Structure
```
pepe-meme-generator/
โโโ src/ # Source code
โ โโโ app.py # Main Streamlit application
โ โโโ Fonts/ # Font files
โ โโโ model/ # Model management
โ โ โโโ __init__.py
โ โ โโโ config.py # Model configurations
โ โ โโโ generator.py # Image generation logic
โ โโโ utils/ # Utility functions
โ โโโ __init__.py
โ โโโ image_processor.py # Image processing utilities
โโโ docs/ # Documentation
โ โโโTRAINING.md # Model training guide
โโโ models/ # Downloaded models (gitignored)
โโโ outputs/ # Generated images (gitignored)
โโโ diffusion_model_finetuning.ipynb # Training notebook
โโโ requirements.txt # Python dependencies
โโโ .gitignore # Git ignore rules
โโโ .dockerignore # Docker ignore rules
โโโ Dockerfile # Docker configuration
โโโ LICENSE # MIT License
โโโ README.md # This file
```
---
## ๐ Training Your Own Model
Want to fine-tune your own Pepe model or create a different character?
### Quick Training Overview
```bash
# 1. Prepare your dataset (images + captions)
# 2. Run the training script
accelerator launch train_text_to_image_lora.py \
--pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" \
--train_data_dir="./your-data" \
--resolution=512 \
--train_batch_size=1 \
--gradient_accumulation_steps=4 \
--max_train_steps=2000 \
--learning_rate=1e-4 \
--lr_scheduler="cosine" \
--output_dir="./output" \
--rank=16
```
### Complete Training Guide
See **[docs/TRAINING.md] for:
- Dataset preparation
- Training configuration
- Hyperparameter tuning
- Validation and testing
- Model upload to Hugging Face
Or check out the **[diffusion_model_finetuning.ipynb](./diffusion_model_finetuning.ipynb)** notebook!
---
## ๐ ๏ธ Technology Stack
### Core Technologies
- **[PyTorch](https://pytorch.org/)** - Deep learning framework
- **[Diffusers](https://github.com/huggingface/diffusers)** - Diffusion models library
- **[Transformers](https://github.com/huggingface/transformers)** - NLP models
- **[PEFT](https://github.com/huggingface/peft)** - Parameter-efficient fine-tuning (LoRA)
- **[Streamlit](https://streamlit.io/)** - Web UI framework
### AI/ML Components
- **Stable Diffusion 1.5** - Base diffusion model
- **LoRA** - Low-Rank Adaptation for efficient fine-tuning
- **LCM** - Latent Consistency Model for fast inference
### Image Processing
- **Pillow (PIL)** - Image manipulation
- **NumPy** - Numerical operations
- **SciPy** - Scientific computing
---
## ๐ค Contributing
Contributions are welcome! Here's how you can help:
### Ways to Contribute
- ๐ Report bugs
- ๐ก Suggest new features
- ๐ Improve documentation
- ๐จ Add new style presets
- โก Optimize performance
- ๐งช Add tests
---
### Development Setup
```bash
# Clone and setup
git clone https://https://github.com/MJaheen/-Pepe-Meme-Generator-
cd pepe-meme-generator
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Make your changes
# Test locally
streamlit run src/app.py
```
# Submit pull request
---
## ๐ Troubleshooting
### Common Issues
**Issue**: Out of memory error
**Solution**: Reduce resolution to 512x512, use CPU mode, or enable memory optimizations
**Issue**: Slow generation on CPU
**Solution**: Use "Pepe + LCM (FAST)" model with 6 steps
**Issue**: Import errors
**Solution**: Reinstall dependencies: `pip install -r requirements.txt --force-reinstall`
---
## ๐ License
This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
### Model Licenses
- **Stable Diffusion 1.5**: CreativeML Open RAIL-M License
- **Pepe LoRA**: MIT License
- **Training Dataset**: Check [iresidentevil/pepe_the_frog](https://huggingface.co/datasets/iresidentevil/pepe_the_frog)
---
## ๐ Acknowledgments
### Special Thanks
- **[WorldQuant University](https://www.wqu.edu/ai-lab-computer-vision)** - AI/ML education and resources
- **[Hugging Face](https://huggingface.co/)** - Model hosting and diffusers library
- **[Stability AI](https://stability.ai/)** - Stable Diffusion model
- **[Microsoft](https://github.com/microsoft/LoRA)** - LoRA technique
- **[iresidentevil](https://huggingface.co/iresidentevil)** - Pepe dataset
---
## ๐ Contact & Support
- **Issues**: Mohamed.a.jaheen@gmail.com
---
## ๐ Star History
If you find this project useful, please consider giving it a โญ star on GitHub!
---
**Made with โค๏ธ by MJaheen**
*Generate Pepes responsibly! ๐ธ*