Skip to content

AditHash/meme-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Meme Generator

Generate memes using Google Gemini models!
This project provides two ways to generate memes:

  • Streamlit App: An interactive web UI.
  • API + CLI: A REST API and a command-line interface.

Installation

  1. Clone the repository (if needed):

    git clone https://github.com/AditHash/meme-generator.git
    cd meme-generator
  2. Install dependencies (preferably in a virtual environment):

    pip install -r requirements.txt

    If you don't have a requirements.txt, install manually:

    pip install streamlit google-generativeai python-dotenv flask
  3. Set up your environment variables:

    • Create a .env file in the project directory.
    • Add your Google Gemini API key:
      GEMINI_API_KEY=your_api_key_here
      

Approach 1: Streamlit App

Run the App

streamlit run streamlit_app.py
  • Open the provided local URL in your browser.
  • Enter your GEMINI_API_KEY in the sidebar (or set it in .env).
  • Enter a meme idea and generate/download your meme.
  • Logs and debug output are available in an expander at the bottom.

Approach 2: API + CLI

1. Run the API Server

python api.py
  • The Flask server will start at http://127.0.0.1:5001.
  • Make POST requests to /generate with a JSON body:
    {
      "prompt": "generate a cat meme"
    }
  • The response will be an image file.

2. Run the CLI (main.py)

python main.py
  • You will be prompted to enter a meme idea in the terminal.
  • The meme will be generated and saved (if you enable saving in the code).

Notes

  • API Key: You can get your Gemini API key from Google AI Studio.
  • Models: You can change the text and image model names in the UI or API as needed.
  • Requirements: Python 3.8+ recommended.

File Overview

  • streamlit_app.py — Streamlit web app (no separate backend needed)
  • api.py — Flask REST API server
  • main.py — Meme generation logic and CLI
  • .env — Store your API key here (not committed to git)
  • README.md — This file

License

MIT License (or specify your own)

Releases

No releases published

Packages

No packages published

Languages