rag-demo / README.md
Phoenixak99's picture
Update README.md
bc005a1 verified

A newer version of the Streamlit SDK is available: 1.52.2

Upgrade
metadata
title: RAG System Demo
emoji: πŸ€—
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: 1.28.1
app_file: app.py
pinned: false

πŸ€— Enterprise RAG System Demo - Hugging Face Edition

A simplified, demonstration version of the Enterprise RAG System that uses Hugging Face models instead of OpenAI/Anthropic APIs. Perfect for showcasing RAG capabilities and deploying on Hugging Face Spaces for free!

πŸš€ Live Demo

Try it on Hugging Face Spaces β†’

✨ What This Demo Shows

This streamlined version demonstrates the complete RAG pipeline of the original Enterprise system:

πŸ”„ Complete RAG Workflow

  • Document Upload & Processing - PDF, DOCX, TXT, CSV support
  • Text Chunking & Embeddings - Smart text splitting with sentence-transformers
  • Vector Search - ChromaDB for semantic similarity search
  • AI-Powered Q&A - Hugging Face transformers for response generation
  • Source Attribution - Shows which documents were used for answers

πŸ—οΈ Enterprise Features (Simplified)

  • Multi-format Support - Same document types as the full system
  • Hybrid Search - Semantic search with relevance scoring
  • Real-time Chat Interface - Interactive Q&A with chat history
  • Source Tracking - See which documents contributed to each answer
  • Responsive UI - Clean, professional interface built with Streamlit

πŸ”§ Technical Architecture

Models Used (Hugging Face)

  • Text Generation: microsoft/DialoGPT-small or distilgpt2 (lightweight)
  • Embeddings: sentence-transformers/all-MiniLM-L6-v2 (384 dimensions)
  • Vector Store: ChromaDB (in-memory for demo)

Key Differences from Original

Original Enterprise System This Demo Version
OpenAI/Anthropic APIs Hugging Face Transformers
PostgreSQL + Redis In-memory storage
JWT Authentication No authentication (demo)
Microservices Architecture Single Streamlit app
Production deployment Hugging Face Spaces

πŸ“¦ Installation & Setup

Option 1: Run Locally

# Clone this demo
git clone <repo-url>
cd rag-demo-hf

# Install dependencies
pip install -r requirements.txt

# Run the app
streamlit run app.py

Option 2: Deploy on Hugging Face Spaces

  1. Create a new Space on Hugging Face
  2. Select Streamlit as the SDK
  3. Upload these files:
    • app.py
    • requirements.txt
    • README.md
  4. Your demo will be live at https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME

🎯 How to Use

1. Upload Documents

  • Click "Upload Documents" in the sidebar
  • Select PDF, DOCX, TXT, or CSV files
  • Click "Process Documents" to add them to the knowledge base

2. Ask Questions

  • Type your question in the chat input
  • The system will:
    • Search for relevant document chunks
    • Generate an AI-powered response
    • Show source documents used

3. Review Sources

  • See relevance scores for each source
  • Click on document excerpts to see the content used
  • Source attribution shows which documents contributed to answers

πŸ“Š Performance & Capabilities

What Works Great

  • βœ… Document Processing - Handles multiple formats reliably
  • βœ… Semantic Search - Finds relevant content accurately
  • βœ… Source Attribution - Clear tracking of information sources
  • βœ… User Experience - Intuitive chat interface

Demo Limitations (vs. Full System)

  • πŸ”„ Text Generation - Smaller models, shorter responses
  • πŸ’Ύ Memory - In-memory storage (resets on restart)
  • πŸ” Security - No authentication or user management
  • πŸ“ˆ Scale - Optimized for demonstration, not production

πŸ”„ Original vs Demo Comparison

Original Enterprise RAG System

  • Purpose: Production-ready enterprise solution
  • Models: OpenAI GPT-4, Anthropic Claude
  • Infrastructure: PostgreSQL, Redis, Docker
  • Features: Authentication, rate limiting, monitoring
  • Deployment: Self-hosted or cloud production

This Demo Version

  • Purpose: Showcase RAG capabilities and architecture
  • Models: Open-source Hugging Face models
  • Infrastructure: Streamlit + in-memory storage
  • Features: Core RAG functionality only
  • Deployment: Hugging Face Spaces (free)

πŸš€ Key Demo Features

1. Real RAG Pipeline

Document Upload β†’ Text Extraction β†’ Chunking β†’ Embeddings β†’ Vector Store β†’ Search β†’ LLM Response

2. Interactive Experience

  • Upload your own documents
  • Ask domain-specific questions
  • See exactly which sources were used
  • Get contextual, relevant answers

3. Educational Value

  • See RAG in action with your own data
  • Understand the workflow from documents to answers
  • Explore source attribution and relevance scoring
  • Experience the full user journey

🎯 Perfect For

  • πŸŽ“ Learning RAG concepts - See how it works end-to-end
  • πŸ’Ό Client demonstrations - Show RAG capabilities quickly
  • πŸ”¬ Prototyping - Test ideas before building production systems
  • πŸ“š Education - Teach AI and NLP concepts interactively

πŸ”— Related Projects

πŸ“ License

MIT License - Feel free to use this demo for learning, presentations, or as a starting point for your own RAG systems!


πŸ€— Built with Hugging Face β€’ Powered by Open Source AI

This demo shows that you can build powerful RAG systems using entirely open-source components!