Spaces:
Sleeping
Sleeping
File size: 1,930 Bytes
83a3714 0753d2e 83a3714 0753d2e 83a3714 0753d2e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
---
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.
|