Inferno-721/Sutra_AI
0
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
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate .\venv\Scripts\activate # On Windows
- Install requirements:
pip install -r requirements.txt- Run the application:
streamlit run app.py- Configure API Key:
- Create a
.envfile in the root directory. - Add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_hereUsage
- Run the application:
streamlit run app.py- Interact:
- Upload PDF files.
- Wait for processing and embedding generation.
- 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.
