Spaces:
Sleeping
A newer version of the Streamlit SDK is available:
1.51.0
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
Demo โข Documentation โข Training Guide โข Report Bug
๐ Table of Contents
- Features
- Quick Start
- Installation
- Usage
- Model Information
- Project Structure
- Training
- Contributing
- License
- Acknowledgments
- 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 - Run instantly in your browser!
Local Installation
# 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
# 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:
pip install -r requirements.txt
GPU Setup (Optional but Recommended)
For NVIDIA GPUs with CUDA:
# 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
- Select a Model: Choose from the dropdown (try "Pepe + LCM (FAST)" for speed)
- Enter a Prompt: e.g., "pepe the frog as a wizard casting spells"
- Adjust Settings: Steps (6 for LCM, 25 for normal), guidance scale, etc.
- Generate: Click "Generate Meme" and wait
- 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
- Select "Pepe + LCM (FAST)" model
- Use 6 steps (optimal for LCM)
- Set guidance scale to 1.5
- Generate in ~30 seconds!
Adding Text Overlays
- Expand "Add Text" section
- Enter top and bottom text
- Text automatically styled in Impact font
- Signature "MJ" added to corner
Reproducible Generations
- Enable "Fixed Seed" in Advanced Settings
- Set a seed number (e.g., 42)
- 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
- 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
# 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 notebook!
๐ ๏ธ Technology Stack
Core Technologies
- PyTorch - Deep learning framework
- Diffusers - Diffusion models library
- Transformers - NLP models
- PEFT - Parameter-efficient fine-tuning (LoRA)
- Streamlit - 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
# 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 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
๐ Acknowledgments
Special Thanks
- WorldQuant University - AI/ML education and resources
- Hugging Face - Model hosting and diffusers library
- Stability AI - Stable Diffusion model
- Microsoft - LoRA technique
- iresidentevil - Pepe dataset
๐ Contact & Support
- Issues: [email protected]
๐ Star History
If you find this project useful, please consider giving it a โญ star on GitHub!
Made with โค๏ธ by MJaheen
Generate Pepes responsibly! ๐ธ