Spaces:
Sleeping
Sleeping
title: Chat With PDF Application | |
emoji: 😻 | |
colorFrom: red | |
colorTo: yellow | |
sdk: streamlit | |
sdk_version: 1.41.1 | |
app_file: app.py | |
pinned: false | |
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. Create and activate a virtual environment: | |
```bash | |
python3 -m venv venv | |
source venv/bin/activate | |
``` | |
# .\venv\Scripts\activate # On Windows | |
2. Install requirements: | |
```bash | |
pip install -r requirements.txt | |
``` | |
3. Run the application: | |
```bash | |
streamlit run app.py | |
``` | |
4. **Configure API Key:** | |
- Create a `.env` file in the root directory. | |
- Add your OpenAI API key: | |
``` | |
OPENAI_API_KEY=your_openai_api_key_here | |
``` | |
## Usage | |
1. **Run the application:** | |
```bash | |
streamlit run app.py | |
``` | |
2. **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. | |