Rsukesh001 commited on
Commit
2498423
Β·
verified Β·
1 Parent(s): 272f1d4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +392 -7
README.md CHANGED
@@ -1,10 +1,395 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: README
3
- emoji: πŸ”₯
4
- colorFrom: pink
5
- colorTo: pink
6
- sdk: static
7
- pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
9
 
10
- Edit this `README.md` markdown file to author your organization card.
 
 
 
 
 
 
 
 
 
1
+ # πŸŽ“ Smart StudyMate - Complete Setup Guide for VS Code
2
+
3
+ ## πŸ“‹ Prerequisites
4
+
5
+ - Windows 10/11, macOS, or Linux
6
+ - Python 3.8 or higher
7
+ - VS Code installed
8
+ - At least 8GB RAM (for running LLaMA 3.1)
9
+ - 10GB free disk space
10
+
11
+ ---
12
+
13
+ ## πŸš€ Step-by-Step Installation
14
+
15
+ ### **Step 1: Install Python**
16
+
17
+ #### Windows:
18
+ 1. Download Python from: https://www.python.org/downloads/
19
+ 2. Run installer and **CHECK** "Add Python to PATH"
20
+ 3. Verify installation:
21
+ ```bash
22
+ python --version
23
+ ```
24
+
25
+ #### Mac/Linux:
26
+ ```bash
27
+ # Mac (using Homebrew)
28
+ brew install python
29
+
30
+ # Linux
31
+ sudo apt update
32
+ sudo apt install python3 python3-pip
33
+ ```
34
+
35
+ ---
36
+
37
+ ### **Step 2: Install VS Code Extensions**
38
+
39
+ Open VS Code and install:
40
+ 1. **Python** (by Microsoft)
41
+ 2. **Pylance** (by Microsoft)
42
+
43
+ ---
44
+
45
+ ### **Step 3: Create Project Folder**
46
+
47
+ ```bash
48
+ # Open terminal in VS Code (Ctrl + ` or Cmd + `)
49
+ mkdir smart-studymate
50
+ cd smart-studymate
51
+ ```
52
+
53
+ ---
54
+
55
+ ### **Step 4: Create Virtual Environment**
56
+
57
+ ```bash
58
+ # Create virtual environment
59
+ python -m venv venv
60
+
61
+ # Activate it
62
+ # Windows:
63
+ venv\Scripts\activate
64
+
65
+ # Mac/Linux:
66
+ source venv/bin/activate
67
+ ```
68
+
69
+ You should see `(venv)` in your terminal now.
70
+
71
+ ---
72
+
73
+ ### **Step 5: Install Python Dependencies**
74
+
75
+ Create a file called `requirements.txt`:
76
+
77
+ ```txt
78
+ flask==3.0.0
79
+ sentence-transformers==2.2.2
80
+ faiss-cpu==1.7.4
81
+ PyPDF2==3.0.1
82
+ python-docx==1.1.0
83
+ python-pptx==0.6.23
84
+ langchain==0.1.0
85
+ langchain-community==0.0.13
86
+ numpy==1.24.3
87
+ ```
88
+
89
+ Install all dependencies:
90
+ ```bash
91
+ pip install -r requirements.txt
92
+ ```
93
+
94
+ ---
95
+
96
+ ### **Step 6: Install Ollama**
97
+
98
+ #### Windows:
99
+ 1. Download from: https://ollama.ai/download
100
+ 2. Run the installer
101
+ 3. Verify installation:
102
+ ```bash
103
+ ollama --version
104
+ ```
105
+
106
+ #### Mac:
107
+ ```bash
108
+ brew install ollama
109
+ ```
110
+
111
+ #### Linux:
112
+ ```bash
113
+ curl -fsSL https://ollama.ai/install.sh | sh
114
+ ```
115
+
116
+ ---
117
+
118
+ ### **Step 7: Download LLaMA 3.1 Model**
119
+
120
+ ```bash
121
+ # This will download ~4.7GB
122
+ ollama pull llama3.1:8b
123
+ ```
124
+
125
+ Wait for download to complete. Verify:
126
+ ```bash
127
+ ollama list
128
+ ```
129
+
130
+ You should see `llama3.1:8b` in the list.
131
+
132
+ ---
133
+
134
+ ### **Step 8: Create Project Files**
135
+
136
+ Create this folder structure:
137
+
138
+ ```
139
+ smart-studymate/
140
+ β”œβ”€β”€ app.py (main application)
141
+ β”œβ”€β”€ requirements.txt (dependencies)
142
+ β”œβ”€β”€ uploads/ (auto-created for uploaded files)
143
+ β”œβ”€β”€ faiss_index/ (auto-created for vector storage)
144
+ └── venv/ (virtual environment)
145
+ ```
146
+
147
+ ---
148
+
149
+ ### **Step 9: Create app.py**
150
+
151
+ Copy the entire Python code I provided earlier into `app.py`.
152
+
153
+ In VS Code:
154
+ 1. File β†’ New File
155
+ 2. Save as `app.py`
156
+ 3. Paste the complete code
157
+
158
+ ---
159
+
160
+ ### **Step 10: Start Ollama Service**
161
+
162
+ **IMPORTANT**: Ollama must be running before starting the app!
163
+
164
+ #### Windows/Mac:
165
+ Ollama runs automatically after installation. Check system tray.
166
+
167
+ #### Linux:
168
+ ```bash
169
+ ollama serve
170
+ ```
171
+
172
+ Keep this terminal open.
173
+
174
+ ---
175
+
176
+ ### **Step 11: Run the Application**
177
+
178
+ Open a new terminal in VS Code and run:
179
+
180
+ ```bash
181
+ # Make sure virtual environment is activated
182
+ # You should see (venv) in terminal
183
+
184
+ python app.py
185
+ ```
186
+
187
+ You should see:
188
+ ```
189
+ ============================================================
190
+ πŸŽ“ Smart StudyMate - AI Study Assistant
191
+ ============================================================
192
+
193
+ Starting server...
194
+ πŸ“Œ Access the application at: http://localhost:5000
195
+
196
+ ⚠️ Make sure Ollama is running with LLaMA 3.1 8B model!
197
+ Run: ollama pull llama3.1:8b
198
+ ============================================================
199
+ ```
200
+
201
+ ---
202
+
203
+ ### **Step 12: Access the Application**
204
+
205
+ Open your browser and go to:
206
+ ```
207
+ http://localhost:5000
208
+ ```
209
+
210
+ ---
211
+
212
+ ## 🎯 Testing the Application
213
+
214
+ ### **1. Upload a Document**
215
+ 1. Click "Choose File"
216
+ 2. Select a PDF/DOCX/TXT/PPTX file
217
+ 3. Click "Upload & Process"
218
+ 4. Wait for processing (you'll see chunks created)
219
+
220
+ ### **2. Ask Questions**
221
+ 1. Make sure "Ask Questions" mode is selected
222
+ 2. Type a question about your notes
223
+ 3. Click "Send"
224
+ 4. Wait for AI response
225
+
226
+ ### **3. Generate Summary**
227
+ 1. Click "Summarize" mode
228
+ 2. Enter topic (or leave empty)
229
+ 3. Click "Send"
230
+
231
+ ### **4. Generate MCQs**
232
+ 1. Click "Generate MCQs" mode
233
+ 2. Enter topic (or leave empty)
234
+ 3. Click "Send"
235
+
236
+ ---
237
+
238
+ ## πŸ”§ Troubleshooting
239
+
240
+ ### **Problem: ModuleNotFoundError**
241
+ **Solution:**
242
+ ```bash
243
+ # Make sure virtual environment is activated
244
+ # Check if (venv) appears in terminal
245
+ pip install -r requirements.txt
246
+ ```
247
+
248
+ ### **Problem: Ollama connection error**
249
+ **Solution:**
250
+ ```bash
251
+ # Check if Ollama is running
252
+ ollama list
253
+
254
+ # If not, start it
255
+ ollama serve
256
+ ```
257
+
258
+ ### **Problem: "No module named 'langchain_community'"**
259
+ **Solution:**
260
+ ```bash
261
+ pip install langchain-community
262
+ ```
263
+
264
+ ### **Problem: Port 5000 already in use**
265
+ **Solution:**
266
+ Change port in `app.py` (last line):
267
+ ```python
268
+ app.run(debug=True, host='0.0.0.0', port=5001)
269
+ ```
270
+
271
+ ### **Problem: FAISS installation error**
272
+ **Solution:**
273
+ ```bash
274
+ # For Windows with issues, try:
275
+ pip install faiss-cpu --no-cache-dir
276
+
277
+ # Or use conda
278
+ conda install -c pytorch faiss-cpu
279
+ ```
280
+
281
+ ### **Problem: Slow responses**
282
+ **Causes:**
283
+ - LLaMA 3.1 requires good CPU/GPU
284
+ - First query is slower (model loading)
285
+ - Large documents take time
286
+
287
+ **Solutions:**
288
+ - Use smaller chunk sizes
289
+ - Reduce `top_k` in retrieval
290
+ - Use a smaller model: `ollama pull llama3.1:8b`
291
+
292
+ ---
293
+
294
+ ## πŸ“Š Checking Logs
295
+
296
+ VS Code terminal will show:
297
+ - File uploads
298
+ - Processing status
299
+ - FAISS index updates
300
+ - API requests
301
+ - Errors (if any)
302
+
303
  ---
304
+
305
+ ## πŸ›‘ Stopping the Application
306
+
307
+ Press `Ctrl + C` in the terminal running `app.py`
308
+
309
+ ---
310
+
311
+ ## πŸ’Ύ Data Persistence
312
+
313
+ Your data is saved in:
314
+ - `faiss_index/index.faiss` - Vector embeddings
315
+ - `faiss_index/metadata.pkl` - Chunk metadata
316
+ - `uploads/` - Uploaded files
317
+
318
+ **To reset everything:**
319
+ ```bash
320
+ # Delete these folders
321
+ rm -rf faiss_index uploads
322
+ ```
323
+
324
+ ---
325
+
326
+ ## πŸŽ“ Sample Test Document
327
+
328
+ Create a test file `test_notes.txt`:
329
+
330
+ ```txt
331
+ Artificial Intelligence
332
+
333
+ Machine Learning is a subset of AI that enables computers to learn from data.
334
+
335
+ Types of Machine Learning:
336
+ 1. Supervised Learning - Uses labeled data
337
+ 2. Unsupervised Learning - Finds patterns in unlabeled data
338
+ 3. Reinforcement Learning - Learns through trial and error
339
+
340
+ Neural Networks are inspired by the human brain and consist of layers of interconnected nodes.
341
+
342
+ Deep Learning uses neural networks with multiple layers to process complex data.
343
+ ```
344
+
345
+ Upload this and test with questions like:
346
+ - "What is machine learning?"
347
+ - "What are the types of machine learning?"
348
+ - "Explain neural networks"
349
+
350
+ ---
351
+
352
+ ## πŸ”₯ Pro Tips
353
+
354
+ 1. **Upload multiple related documents** for better context
355
+ 2. **Ask specific questions** for better answers
356
+ 3. **Use summarize feature** to get quick overviews
357
+ 4. **Generate MCQs** for self-testing
358
+ 5. **Check stats** to see how many vectors are stored
359
+
360
+ ---
361
+
362
+ ## πŸ“± Accessing from Other Devices
363
+
364
+ To access from other devices on the same network:
365
+
366
+ 1. Find your IP address:
367
+ ```bash
368
+ # Windows
369
+ ipconfig
370
+
371
+ # Mac/Linux
372
+ ifconfig
373
+ ```
374
+
375
+ 2. Change `app.py` last line:
376
+ ```python
377
+ app.run(debug=True, host='0.0.0.0', port=5000)
378
+ ```
379
+
380
+ 3. Access from other device:
381
+ ```
382
+ http://YOUR_IP_ADDRESS:5000
383
+ ```
384
+
385
  ---
386
 
387
+ ## πŸŽ‰ You're All Set!
388
+
389
+ Your Smart StudyMate is now running locally with:
390
+ - βœ… Local LLM (no API keys needed)
391
+ - βœ… Persistent storage
392
+ - βœ… Multi-format support
393
+ - βœ… AI-powered features
394
+
395
+ Happy studying! πŸ“šπŸš€