paper_based_rag / README.md
ะฎั€ะฐ ะฆะตะฟะปั–ั†ัŒะบะธะน
Change default paper
af8b652

A newer version of the Gradio SDK is available: 5.16.0

Upgrade
metadata
title: Paper-based RAG
emoji: ๐Ÿ“„
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 5.8.0
app_file: app.py
python_version: 3.11.0
models:
  - sentence-transformers/all-mpnet-base-v2
tags:
  - question-answering
  - gradio
  - LLM
  - document-processing

Document QA System

Document Question-Answering system that utilizes LlamaIndex for document indexing, generation, and retrieval and Gradio for the user interface.

Technologies

  • Data source
    • Paper about BERT located in the data directory are used as the data source for indexing.
  • Chunking
  • LLM
    • The system utilizes the gpt-4o-mini for generating responses
  • Retriever, Reranker
    • gpt-4o-mini is used
  • UI
    • The user interface is built with Gradio

Installation

Prerequisites

  1. Docker:

  2. API keys

Using HuggingFace Spaces

  1. Follow the link to the paper-based-rag on Spaces.
  2. Upload your paper for indexing or use the default paper about BERT.

Using Docker

  1. Build the Docker Image:

    docker build -t doc-qa-system .
    
  2. Run the Docker Container:

     docker run -p 7860:7860 doc-qa-system
    
  3. Access the Interface:

    • Open your browser and go to http://localhost:7860.

Using Python

  1. Install Dependencies:

    pip install -r requirements.txt
    
  2. Add paper to the data directory:

    • Add the paper you want to index to the data directory or use default paper about BERT.
  3. Run indexing data:

    python index.py
    
  4. Run the Application:

    python app.py
    

Project structure

โ”œโ”€โ”€ app.py                   # Gradio application
โ”œโ”€โ”€ main.py                  # Main script for answering queries
โ”œโ”€โ”€ utils/                   # Utility functions and helpers
โ”‚   โ”œโ”€โ”€ constant.py          # Constant values used in the project
โ”‚   โ”œโ”€โ”€ index.py             # Handles document indexing
โ”‚   โ”œโ”€โ”€ retriever.py         # Retrieves and ranks documents
โ”‚   โ”œโ”€โ”€ settings.py          # Configuration settings
โ”œโ”€โ”€ data/                    # Directory containing documents to be indexed
โ”œโ”€โ”€ index/                   # Stores the generated index files
โ”‚   โ”œโ”€โ”€ default__vector_store.json
โ”‚   โ”œโ”€โ”€ docstore.json
โ”‚   โ”œโ”€โ”€ graph_store.json
โ”‚   โ”œโ”€โ”€ image__vector_store.json
โ”‚   โ”œโ”€โ”€ index_store.json
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ Dockerfile               # Docker configuration
โ”œโ”€โ”€ README.md                # Project documentation 

Example questions

  • What is the pre-training procedure for BERT, and how does it differ from traditional supervised learning?
  • Can you describe how BERT can be fine-tuned for tasks like question answering or sentiment analysis?