CoolFace
Apppublic

Inferno-721/Sutra_AI

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Chat with PDF Application

Chat with PDF is an interactive Streamlit app that lets you upload PDFs, converts their content into embeddings using OpenAI, and enables question-answering via GPT-4.

Features

  • PDF Upload: Upload one or multiple PDFs.
  • Text Extraction & Chunking: Extracts text from PDFs and splits it into manageable chunks.
  • Embedding Generation: Converts text chunks into embeddings using OpenAI's text-embedding-ada-002.
  • Question Answering: Ask questions about your documents and get context-aware answers generated by GPT-4.
  • Context Display: View relevant sections from the PDF that support the generated answers.

Installation

Setup

  1. 1.Create and activate a virtual environment:
bash
    python3 -m venv venv
    source venv/bin/activate 

.\venv\Scripts\activate # On Windows

  1. 1.Install requirements:
bash
   pip install -r requirements.txt
  1. 1.Run the application:
bash
   streamlit run app.py
  1. 1.Configure API Key:
  2. 2.Create a .env file in the root directory.
  3. 3.Add your OpenAI API key:
     OPENAI_API_KEY=your_openai_api_key_here

Usage

  1. 1.Run the application:
bash
   streamlit run app.py
  1. 1.Interact:
  2. 2.Upload PDF files.
  3. 3.Wait for processing and embedding generation.
  4. 4.Enter a question to get answers with relevant context excerpts from your PDFs.

Notes

  • The app meets core requirements: PDF uploading, text processing, embedding conversion, and Q&A.
  • While context is shown, highlighting directly on the PDF is not implemented yet.
  • Supports multiple PDF uploads and cross-document querying.