# πΌοΈ AI-Powered Image Caption Generator β¨ This is a full-stack **AI Caption Generator** that automatically recognizes the content of an uploaded image and returns **short, fancy social media captions**. It uses **BLIP (Salesforce)** for image understanding and **LLaMA 3 (via Groq)** for generating enhanced, catchy captions. The frontend is built with **HTML, CSS, and JavaScript**, and the backend is powered by **Flask**. --- ## π Features - π§ **BLIP Model** for intelligent image captioning - β¨ **Fancy Caption Generation** with LLaMA 3 via Groq - π· Simple drag-and-drop image upload - π Frontend built with HTML, CSS, and JavaScript - π Secure API integration using environment variables - π CORS-enabled backend --- ## π― Use Case Perfect for: - Social media content creators - Marketing agencies - Travel/lifestyle bloggers - Memers and content designers --- ## π§ How It Works 1. π€ User uploads an image through the web UI. 2. π€ Flask backend uses the **BLIP model** to generate a base caption. 3. π§βπ» That caption is passed to **LLaMA 3 (Groq API)** to return **5 short & catchy captions**. 4. π The fancy caption is returned and shown on the frontend. --- ## π οΈ Tech Stack ### Backend - Python - Flask - BLIP (`Salesforce/blip-image-captioning-base`) - Groq API with LLaMA 3 - Pillow (Image processing) ### Frontend - HTML - CSS - JavaScript (AJAX + Fetch API) --- ## π¦ Installation ### π§ Backend Setup 1. **Clone the repository** ```bash git clone https://github.com/yourusername/ai-caption-generator.git cd ai-caption-generator
-
Create virtual environment and activate
python -m venv venv source venv/bin/activate # For Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up
.envfileGROQ_API_KEY=your_groq_api_key_here -
Run the Flask server
python app.py
- Navigate to the
/frontendfolder. - Open
index.htmlin a browser or serve it using a live server. - Upload an image and get your caption!
ai-caption-generator/
βββ app.py # Flask backend
βββ .env # Groq API key
βββ requirements.txt # Python dependencies
βββ frontend/
β βββ index.html # Main frontend file
β βββ styles.css # CSS styles
β βββ script.js # JavaScript to call Flask API
βββ README.md # Project documentation
Input Image: A person standing on a mountain at sunset π
Generated Captions:
1. Chasing horizons βοΈ
2. Sunset vibes only π
3. Peaks and peace ποΈ
4. Golden hour goals β¨
5. On top of the world π
Never expose your .env file or API keys in public repositories. Add .env to .gitignore.
Built by [Your Name] π§ labibalif2001@gmail.com π LinkedIn
This project is licensed under the MIT License.