ChiragKaushikCK commited on
Commit
b34c81b
Β·
verified Β·
1 Parent(s): 854bfaa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -102
README.md CHANGED
@@ -1,142 +1,97 @@
1
  ---
2
- title: Advanced PDF Chat Assistant
3
- emoji: πŸ“š
4
- colorFrom: purple
5
- colorTo: blue
6
  sdk: streamlit
7
- sdk_version: "1.31.0"
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- # πŸ“š Advanced PDF Chat Assistant
13
 
14
- An intelligent PDF chat application with multiple AI models and interactive preprocessing.
15
 
16
  ## ✨ Features
17
 
18
- ### πŸ€– **Three Modes of Operation**
19
- 1. **Standard Chat** - Vector-based retrieval with Google FLAN-T5
20
- 2. **Advanced Chat** - Powered by Google Gemini 2.5 Flash (requires API key)
21
- 3. **Document Summary** - BART-powered intelligent summaries
22
 
23
  ### 🎯 **Key Capabilities**
24
- - πŸ“€ **Easy PDF Upload** - Drag and drop interface
25
- - βš™οΈ **Interactive Preprocessing** - Customize chunk size, overlap, and text cleaning
26
- - πŸ’¬ **Conversational AI** - Natural language conversations with your documents
27
- - πŸ“Š **Document Statistics** - Real-time processing metrics
28
- - 🎨 **Beautiful UI** - Modern, gradient-based design with animations
29
- - ⚑ **Quick Actions** - Pre-defined questions for instant insights
30
- - πŸ“₯ **Export Summaries** - Download generated summaries
31
 
32
  ## πŸš€ How to Use
33
 
34
- ### 1. Upload Your PDF
35
- - Click "Browse files" or drag and drop your PDF in the sidebar
 
36
 
37
- ### 2. Configure Processing (Optional)
38
- - Expand "Advanced Preprocessing" to customize:
39
- - Chunk Size (500-2000 characters)
40
- - Chunk Overlap (0-500 characters)
41
- - Text cleaning options
42
 
43
- ### 3. Select Mode
44
- - **Standard Chat**: Best for general Q&A with embedded knowledge
45
- - **Advanced Chat**: Requires Gemini API key, best for complex reasoning
46
- - **Document Summary**: Generate concise summaries
47
-
48
- ### 4. Process PDF
49
- - Click "πŸš€ Process PDF" button
50
- - Wait for processing to complete
51
-
52
- ### 5. Start Chatting!
53
- - Type your questions in the chat box
54
- - Use Quick Actions for common queries
55
- - View chat history in real-time
56
-
57
- ## πŸ”‘ Getting a Gemini API Key
58
-
59
- For Advanced Chat mode:
60
- 1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
61
- 2. Sign in with your Google account
62
- 3. Create a new API key
63
- 4. Paste it in the sidebar
64
 
65
  ## πŸ› οΈ Technical Stack
66
 
67
- - **Frontend**: Streamlit
68
- - **PDF Processing**: PyPDF2
69
- - **Embeddings**: sentence-transformers/all-MiniLM-L6-v2
70
- - **Vector Store**: FAISS
71
- - **LLM (Standard)**: Google FLAN-T5-base
72
- - **Summarization**: facebook/bart-large-cnn
73
- - **LLM (Advanced)**: Google Gemini 2.5 Flash
74
- - **Framework**: LangChain
75
 
76
  ## πŸ“¦ Installation (Local)
77
 
78
- ```bash
79
- git clone <your-repo>
80
- cd <your-repo>
81
- pip install -r requirements.txt
82
- streamlit run app.py
83
- ```
84
 
85
- ## 🌟 Features Breakdown
86
 
87
- ### Standard Chat Mode
88
- - Uses vector embeddings for semantic search
89
- - FLAN-T5 model generates responses
90
- - Maintains conversation history
91
- - Fast and efficient
92
 
93
- ### Advanced Chat Mode (Gemini)
94
- - Direct PDF processing with Gemini
95
- - Superior understanding of document context
96
- - Advanced reasoning capabilities
97
- - Requires API key
98
 
99
- ### Document Summary Mode
100
- - BART model trained on CNN/DailyMail
101
- - Customizable summary length
102
- - Extract key points efficiently
103
- - Downloadable summaries
104
 
105
- ## πŸ’‘ Tips
 
106
 
107
- 1. **For best results**: Use clear, specific questions
108
- 2. **Long documents**: Standard mode chunks documents for better processing
109
- 3. **Complex queries**: Use Advanced (Gemini) mode for deep reasoning
110
- 4. **Quick insights**: Try the Quick Action buttons
111
 
112
- ## πŸ“ Example Questions
113
 
114
- - "What is this document about?"
115
- - "Summarize the main findings"
116
- - "What are the key recommendations?"
117
- - "Explain the methodology used"
118
- - "List all important dates mentioned"
119
 
120
- ## ⚠️ Limitations
121
 
122
- - Maximum PDF size: Depends on Hugging Face Space limits
123
- - Gemini API: Requires valid API key and has usage limits
124
- - Processing time: Varies based on document size
125
 
126
- ## 🀝 Contributing
127
-
128
- Contributions are welcome! Please feel free to submit issues or pull requests.
129
-
130
- ## πŸ“„ License
131
 
 
132
  MIT License
133
 
134
- ## πŸ”— Links
 
135
 
136
- - [Hugging Face Spaces](https://huggingface.co/spaces)
137
- - [LangChain Documentation](https://python.langchain.com/)
138
- - [Google Gemini API](https://ai.google.dev/)
139
 
140
- ---
141
 
142
- Made with ❀️ using Streamlit and Hugging Face
 
1
  ---
2
+ title: DocTalk - Chat With PDF
3
+ emoji: πŸ“—πŸ’¬
4
+ colorFrom: indigo
5
+ colorTo: pink
6
  sdk: streamlit
7
+ sdk_version: "1.35.0"
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
+ # πŸ“—πŸ’¬ DocTalk - Chat With PDF
13
 
14
+ An intelligent, completely free-to-run PDF chat application powered by Google's Gemma-2-2b-it model. Optimized for CPU usage on Hugging Face Spaces.
15
 
16
  ## ✨ Features
17
 
18
+ ### πŸ€– **Core Engine**
19
+ * **Model:** Google Gemma-2-2B-IT (Instruction Tuned)
20
+ * **Architecture:** Runs entirely locally on CPU (no GPU required)
21
+ * **Performance:** Optimized with FAISS for instant vector retrieval
22
 
23
  ### 🎯 **Key Capabilities**
24
+ * ⚑ **CPU Optimized** - Runs smoothly on Hugging Face Free Tier
25
+ * πŸ“€ **Easy Upload** - Simple sidebar PDF upload
26
+ * 🧠 **Smart Context** - Uses `all-MiniLM-L6-v2` for precise semantic search
27
+ * πŸ’¬ **Memory** - Maintains chat history within the session
28
+ * πŸ”’ **Secure** - Handles Hugging Face tokens via environment secrets
 
 
29
 
30
  ## πŸš€ How to Use
31
 
32
+ ### 1. Set Up Authentication
33
+ * This app requires a **Hugging Face Access Token** (Read permissions) to download the Gemma model.
34
+ * **For Users:** Enter your token in the app sidebar if prompted (or set it in Space secrets).
35
 
36
+ ### 2. Upload Your PDF
37
+ * Navigate to the sidebar
38
+ * Click "Browse files" to upload your PDF document
39
+ * Click **"πŸš€ Process Document"**
 
40
 
41
+ ### 3. Start Chatting!
42
+ * Wait for the "βœ… Ready to chat!" notification
43
+ * Type your question in the chat input at the bottom
44
+ * Receive concise, context-aware answers from Gemma-2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  ## πŸ› οΈ Technical Stack
47
 
48
+ * **Frontend**: Streamlit
49
+ * **LLM**: google/gemma-2-2b-it
50
+ * **Embeddings**: sentence-transformers/all-MiniLM-L6-v2
51
+ * **Vector Store**: FAISS (Facebook AI Similarity Search)
52
+ * **PDF Processing**: PyPDFLoader
53
+ * **Orchestration**: LangChain
 
 
54
 
55
  ## πŸ“¦ Installation (Local)
56
 
57
+ To run this app on your own machine:
 
 
 
 
 
58
 
59
+ https://huggingface.co/spaces/ChiragKaushikCK/Chat_with_PDF
60
 
61
+ **🌟 Features Breakdown**
62
+ FAISS Vector Search
63
+ Replaces heavy database lookups with lightweight, in-memory similarity search.
 
 
64
 
65
+ Ensures responses are strictly grounded in your uploaded document.
 
 
 
 
66
 
67
+ Pre-loaded Models
68
+ The embedding models are cached (@st.cache_resource) to ensure the app feels snappy after the initial cold start.
 
 
 
69
 
70
+ Gemma-2-2B-IT
71
+ Google's latest lightweight open model.
72
 
73
+ Instruction-tuned for better Q&A performance compared to base models.
 
 
 
74
 
75
+ Small enough (~2.6B params) to fit in standard RAM.
76
 
77
+ **⚠️ Limitations**
78
+ Speed: Since this runs on CPU, generating long answers may take a few seconds.
 
 
 
79
 
80
+ Memory: Designed for standard PDFs. Extremely large files (500+ pages) might hit RAM limits on free tiers.
81
 
82
+ Session: Chat history is cleared if the page is refreshed.
 
 
83
 
84
+ 🀝 Contributing
85
+ Contributions are welcome! Please feel free to submit issues or pull requests to improve the UI or add new features.
 
 
 
86
 
87
+ πŸ“„ License
88
  MIT License
89
 
90
+ πŸ”— Links
91
+ Google Gemma Models
92
 
93
+ LangChain Documentation
 
 
94
 
95
+ Streamlit
96
 
97
+ <div align="center"> Made with ❀️ with Streamlit and Gemma model, by Tannu Yadav </div>