vibe-reader / README.md
carolinacc's picture
update readme
9165373 verified
|
raw
history blame
9.42 kB
metadata
title: Vibe Reader
emoji: ๐ŸŒ–
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 6.0.1
app_file: app.py
pinned: false
short_description: Describe your new favorite book through vibes
tags:
  - mcp-in-action-track-creative
  - anthropic
  - nebius
  - modal
  - elevenlabs

๐Ÿ“š The Vibe Reader

Upload images that capture a mood. Get books that feel the same way.

The Vibe Reader is an AI-powered book recommendation engine that understands aesthetics, not just genres. Upload a mood board, a painting, a cozy photo, or any image that captures the feeling you want from your next readโ€”and discover books that match that vibe.

๐Ÿ† Built for the HuggingFace x Gradio MCP Hackathon

๐ŸŽฏ The Problem

Traditional book recommendations fail when you can't articulate what you want:

  • "I want something that feels like a rainy afternoon in an old library" โ€” Good luck searching that on Goodreads
  • Genre fatigue: You don't want "fantasy" or "romance"โ€”you want a specific feeling
  • Visual inspiration: You found the perfect aesthetic on Pinterest but can't translate it to books
  • Discovery paralysis: Too many options, no way to filter by vibe

โœจ The Solution

The Vibe Reader bridges the gap between visual aesthetics and literary recommendations:

  1. ๐ŸŽจ Upload Your Vibe โ€” Share 1-5 images that capture the mood you're seeking
  2. ๐Ÿ”ฎ AI Analysis โ€” Vision AI extracts aesthetic keywords, mood, themes, and tropes
  3. ๐Ÿ’ฌ Conversational Refinement โ€” Chat to fine-tune the vibe description
  4. ๐Ÿ“š Semantic Search โ€” Query a vector database of 50k+ book-vibe associations
  5. ๐ŸŽฏ Smart Narrowing โ€” Answer quick either/or questions to find your perfect match
  6. ๐ŸŽต Bonus: Vibe Soundtrack โ€” Get an AI-generated ambient track for your reading session

๐Ÿ“Š The Dataset: Building a Vibe-to-Book Knowledge Base

A core contribution of this project is the data pipeline that transforms Reddit's r/BooksThatFeelLikeThis community into a structured, searchable recommendation dataset.

Data Collection Pipeline

Reddit Posts (1,500+ with images)
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  1. scrape_subreddit.py         โ”‚  โ† Reddit API (PRAW)
โ”‚     Collect posts + comments    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  2. extract_vibes.py            โ”‚  โ† Nebius VLM (Gemma 3 27B)
โ”‚     Analyze images โ†’ vibe JSON  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  3. extract_books.py            โ”‚  โ† Anthropic LLM (Claude Haiku)
โ”‚     Parse comments โ†’ book list  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  4. fetch_google_books.py       โ”‚  โ† Google Books API
โ”‚     Enrich with metadata        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  5. build_vector_index.py       โ”‚  โ† Nebius Embeddings (Qwen3-Embedding-8B)
โ”‚     Generate embeddings + FAISS โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
    Vector Store (Modal)
    50k+ book-vibe associations

What Each Step Produces

Step Input Output AI Used
Scrape r/BooksThatFeelLikeThis Posts with images + nested comments โ€”
Extract Vibes Post images Structured vibe JSON (aesthetics, mood, themes, tropes) Nebius Gemma 3 27B
Extract Books Comment threads Book titles + authors Nebius Qwen 3 30B
Fetch Metadata Book list Covers, descriptions, ISBNs, ratings Google Books API
Build Index Vibes + Books FAISS vector index Nebius Qwen3-Embedding-8B

Vibe Data Structure

Each post is annotated with rich vibe metadata:

{
  "aesthetic_genre_keywords": ["Dark Academia", "Gothic", "Victorian"],
  "mood_atmosphere": ["Melancholic", "Mysterious", "Atmospheric"],
  "core_themes": ["Isolation", "Obsession", "Hidden knowledge"],
  "tropes": ["Unreliable narrator", "Secret society", "Forbidden library"],
  "feels_like": "A haunting exploration of obsession set in the dusty halls of an ancient university, where every shadow holds secrets and the pursuit of knowledge comes at a terrible price..."
}

๐Ÿ—๏ธ Runtime Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Gradio UI      โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  LangGraph Agent โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Modal Vector   โ”‚
โ”‚  (Upload/Chat)  โ”‚     โ”‚  (Orchestration) โ”‚     โ”‚  Store (FAISS)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ–ผ                     โ–ผ                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Nebius VLM     โ”‚   โ”‚  Google Books   โ”‚   โ”‚  ElevenLabs     โ”‚
โ”‚  (Gemma 3 27B)  โ”‚   โ”‚  MCP Server     โ”‚   โ”‚  MCP Server     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Project Structure

vibe-reader/
โ”œโ”€โ”€ app/                        # Main application
โ”‚   โ”œโ”€โ”€ app.py                  # Gradio interface
โ”‚   โ”œโ”€โ”€ agent.py                # LangGraph workflow with interrupts
โ”‚   โ”œโ”€โ”€ prompts.py              # LLM prompt templates
โ”‚   โ”œโ”€โ”€ utils.py                # Helper functions
โ”‚   โ””โ”€โ”€ custom.css              # Styling
โ”œโ”€โ”€ google_books_mcp_2/         # Google Books MCP server
โ”‚   โ””โ”€โ”€ app.py                  # Gradio MCP implementation
โ”œโ”€โ”€ modal_app/                  # Vector store deployment
โ”‚   โ”œโ”€โ”€ build_vector_index.py   # Index builder
โ”‚   โ””โ”€โ”€ vector_store.py         # Modal serverless endpoint
โ”œโ”€โ”€ scripts/                    # Data pipeline
โ”‚   โ”œโ”€โ”€ scrape_subreddit.py     # Reddit data collection
โ”‚   โ”œโ”€โ”€ extract_vibes.py        # VLM vibe extraction
โ”‚   โ”œโ”€โ”€ extract_books.py        # LLM book extraction
โ”‚   โ”œโ”€โ”€ fetch_google_books.py   # Metadata enrichment
โ”‚   โ””โ”€โ”€ clean_vibes.py          # Data cleaning
โ””โ”€โ”€ docs/                       # Documentation
    โ”œโ”€โ”€ DATA_PIPELINE.md        # Detailed pipeline guide
    โ”œโ”€โ”€ ARCHITECTURE.md         # System design
    โ””โ”€โ”€ AGENT_FLOW.md           # LangGraph workflow

๐Ÿ”Œ MCP Server Integration

The Vibe Reader uses two MCP servers built with Gradio:

Google Books MCP Server

Provides book metadata enrichment via the Gradio MCP protocol:

  • Search by title + author
  • Retrieve covers, descriptions, ISBNs
  • Deployed on Hugging Face Spaces

ElevenLabs MCP Server

Generates ambient soundtracks that match your reading vibe:

  • AI-composed background music
  • Mood-matched audio generation
  • 30-second ambient tracks

โš™๏ธ Configuration

Copy .env.example to .env and configure:

# Required: Nebius API for VLM + LLM + Embeddings
NEBIUS_API_KEY=your_key_here

# Required: Modal vector store URL
MODAL_VECTOR_STORE_URL=https://your-modal-app.modal.run/search

# Required: Google Books MCP
GOOGLE_BOOKS_MCP_URL=https://your-space.hf.space

# Optional: ElevenLabs for soundtracks
ELEVENLABS_API_KEY=your_key_here




---

## ๐Ÿ“„ License

MIT License. See [LICENSE](LICENSE) for details.

---

## ๐Ÿ™ Acknowledgments

- **[r/BooksThatFeelLikeThis](https://reddit.com/r/BooksThatFeelLikeThis)** โ€” The incredible community whose posts power our dataset
- **[Gradio MCP Hackathon](https://gradio.app)** 
- **[Nebius](https://nebius.com)** โ€” VLM, LLM, and embedding models for data annotation and runtime inference
- **[ElevenLabs](https://elevenlabs.io)** โ€” AI soundtrack generation
- **[Modal](https://modal.com)** โ€” Serverless vector store deployment
- **[Google Books API](https://developers.google.com/books)** โ€” Book metadata enrichment

---

Made with ๐Ÿ“š for the Gradio MCP Hackathon

*"Every book has a vibe. Now you can search by it."*