Skip to content

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Social Mood Matcher โ€“ AI-Powered Caption & Hashtag Generator

Social Mood Matcher Python Streamlit License

Production-ready Streamlit application for generating AI-powered social media captions with sentiment detection and trending hashtags.

Features โ€ข Installation โ€ข Usage โ€ข Architecture โ€ข Deployment


๐ŸŽฏ Overview

Social Mood Matcher is an AI-powered web application built with Python and Streamlit that analyzes uploaded images and generates engaging social media captions with relevant hashtags. Users can customize the caption style and target platform to create content suitable for Instagram, Facebook, and Twitter/X.

โœจ Features

  • ๐ŸŽญ Image Sentiment Detection
  • โœ๏ธ Smart Caption Generation
  • #๏ธโƒฃ Trending Hashtag Engine
  • ๐Ÿ“ Character Limiting
  • ๐ŸŽจ Beautiful UI
  • ๐Ÿš€ Production Ready

๐Ÿ› ๏ธ Tech Stack

๐Ÿ› ๏ธ Tech Stack

Python Streamlit PyTorch HuggingFace Git

๐Ÿ“ธ Screenshots

Main Interface

Screenshot 2026-07-11 160448

Results Display

Screenshot 2026-07-11 160840

๐Ÿ—๏ธ Architecture

graph TD
    A[User Uploads Image] --> B[Image Validation]
    B --> C[Image Sentiment Detection]
    C --> D[BLIP Image Captioning]
    D --> E[Sentiment Analysis]
    E --> F[Caption Generation]
    E --> G[Hashtag Engine]
    F --> H[Character Limiter]
    G --> H
    H --> I[Final Output]
    I --> J[Display to User]
Loading

Project Structure

social-mood-matcher/
โ”‚
โ”œโ”€โ”€ app.py                      # Main Streamlit application
โ”œโ”€โ”€ requirements.txt            # Python dependencies
โ”œโ”€โ”€ README.md                   # This file
โ”œโ”€โ”€ .env.example               # Environment template
โ”‚
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ settings.py            # Centralized configuration
โ”‚
โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ image_sentiment.py     # Sentiment detection service
โ”‚   โ”œโ”€โ”€ caption_generator.py   # Caption generation service
โ”‚   โ”œโ”€โ”€ hashtag_engine.py      # Hashtag recommendation engine
โ”‚   โ””โ”€โ”€ character_limiter.py   # Character limiting service
โ”‚
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ image_utils.py         # Image processing utilities
โ”‚   โ””โ”€โ”€ text_utils.py          # Text processing utilities
โ”‚
โ”œโ”€โ”€ assets/
โ”‚   โ””โ”€โ”€ sample_images/         # Sample test images
โ”‚
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_pipeline.py       # Test suite

๐Ÿš€ Installation

Prerequisites

  • Python 3.10 or higher
  • pip package manager
  • 4GB+ RAM (for AI models)

Step 1: Clone or Download

cd "c:\Users\prana\OneDrive\Desktop\Kitchen Vision"

Step 2: Create Virtual Environment (Recommended)

python -m venv venv

# Windows
venv\Scripts\activate

# Linux/Mac
source venv/bin/activate

Step 3: Install Dependencies

pip install -r requirements.txt

Note: First-time installation will download AI models (~2GB). This is a one-time process.

Step 4: Configure Environment (Optional)

copy .env.example .env
# Edit .env if you want to customize settings

๐Ÿ’ป Usage

Running the Application

streamlit run app.py

The application will open in your default browser at http://localhost:8501

Using the Application

  1. Upload Image - Click "Browse files" and select an image (JPG, PNG, WEBP)
  2. Configure Settings - Choose caption style, platform, and number of hashtags in the sidebar
  3. Generate - Click "๐Ÿš€ Generate Caption & Hashtags"
  4. Copy & Share - Copy the generated content and paste it on your social media!

Caption Styles

  • Casual - Friendly and relaxed tone with moderate emoji usage
  • Aesthetic - Artistic and poetic with minimal emojis
  • Professional - Polished and informative with no emojis
  • Playful - Fun and energetic with high emoji usage

Supported Platforms

  • Twitter/X - 280 character limit
  • Instagram - 2,200 character limit
  • Facebook - 63,206 character limit

๐Ÿง  AI Models

The application uses the following Hugging Face models:

Component Model Purpose
Image Captioning Salesforce/blip-image-captioning-base Understand image content
Sentiment Analysis distilbert-base-uncased-finetuned-sst-2-english Detect sentiment
Caption Templates Custom template system Generate engaging captions

All models run locally - no API keys required!


๐Ÿงช Testing

Run the test suite:

pytest tests/test_pipeline.py -v

Run with coverage:

pytest tests/test_pipeline.py --cov=. --cov-report=html

๐ŸŒ Deployment

Streamlit Cloud (Recommended)

  1. Push your code to GitHub
  2. Go to share.streamlit.io
  3. Connect your repository
  4. Deploy!

Docker Deployment

Create a Dockerfile:

FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8501

CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]

Build and run:

docker build -t social-mood-matcher .
docker run -p 8501:8501 social-mood-matcher

AWS/GCP/Azure

The application can be deployed on any cloud platform that supports Python and Streamlit. See Streamlit deployment docs for detailed guides.


โš™๏ธ Configuration

Environment Variables

Create a .env file from .env.example:

# Debug Settings
DEBUG=False
LOG_LEVEL=INFO

# Model Cache Directory
MODEL_CACHE_DIR=./models_cache

# Optional API Keys (for future features)
# OPENAI_API_KEY=your_key_here
# HUGGINGFACE_API_KEY=your_key_here

Customizing Settings

Edit config/settings.py to customize:

  • Model configurations
  • Character limits
  • Hashtag counts
  • UI settings
  • Sentiment categories
  • Caption styles

๐Ÿ“Š Performance

  • First Run: ~30-60 seconds (model loading)
  • Subsequent Runs: ~3-5 seconds per image
  • Model Size: ~2GB (cached locally)
  • Memory Usage: ~2-4GB RAM

Optimization Tips:

  • Use GPU if available (change device in config/settings.py)
  • Enable caching (enabled by default)
  • Reduce image size before upload

๐Ÿ”ฎ Future Enhancements

  • Multiple caption variants with A/B testing
  • Download caption as .txt file
  • Light/Dark UI mode toggle
  • Real-time trending hashtag API integration
  • Multi-language support
  • Batch processing for multiple images
  • Custom hashtag suggestions
  • Analytics dashboard
  • Social media direct posting
  • Video support

๐Ÿค– AI-Assisted Development

This project was developed with significant assistance from AI coding tools for project planning, code generation, debugging, and documentation. The application was customized, tested, integrated, and deployed by me.

AI tools used:

  • ChatGPT
  • Gemini
  • Hugging Face Transformers

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


๐Ÿ‘จโ€๐Ÿ’ป Author

Jeeva L

๐ŸŽ“ BCA Graduate

๐Ÿ“ง Email: jeevalawrance2004@gmail.com

๐Ÿ’ผ LinkedIn: https://linkedin.com/in/jeeva-l-5bb2a4387

About

An AI-powered Streamlit application that generates engaging social media captions and relevant hashtags from uploaded images using Hugging Face models.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages