local-notebooklm 0.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. local_notebooklm-0.5.2/MANIFEST.in +27 -0
  2. local_notebooklm-0.5.2/PKG-INFO +383 -0
  3. local_notebooklm-0.5.2/README.md +364 -0
  4. local_notebooklm-0.5.2/examples/JOSIEv4o.pdf +0 -0
  5. local_notebooklm-0.5.2/examples/podcast-medium.wav +0 -0
  6. local_notebooklm-0.5.2/examples/podcast.wav +0 -0
  7. local_notebooklm-0.5.2/local_notebooklm/__init__.py +1 -0
  8. local_notebooklm-0.5.2/local_notebooklm/config.py +50 -0
  9. local_notebooklm-0.5.2/local_notebooklm/processor.py +127 -0
  10. local_notebooklm-0.5.2/local_notebooklm/server.py +290 -0
  11. local_notebooklm-0.5.2/local_notebooklm/start.py +45 -0
  12. local_notebooklm-0.5.2/local_notebooklm/steps/__init__.py +0 -0
  13. local_notebooklm-0.5.2/local_notebooklm/steps/helpers.py +100 -0
  14. local_notebooklm-0.5.2/local_notebooklm/steps/prompts.py +243 -0
  15. local_notebooklm-0.5.2/local_notebooklm/steps/step1.py +183 -0
  16. local_notebooklm-0.5.2/local_notebooklm/steps/step2.py +175 -0
  17. local_notebooklm-0.5.2/local_notebooklm/steps/step3.py +251 -0
  18. local_notebooklm-0.5.2/local_notebooklm/steps/step4.py +126 -0
  19. local_notebooklm-0.5.2/local_notebooklm/version.py +1 -0
  20. local_notebooklm-0.5.2/local_notebooklm.egg-info/PKG-INFO +383 -0
  21. local_notebooklm-0.5.2/local_notebooklm.egg-info/SOURCES.txt +25 -0
  22. local_notebooklm-0.5.2/local_notebooklm.egg-info/dependency_links.txt +1 -0
  23. local_notebooklm-0.5.2/local_notebooklm.egg-info/top_level.txt +1 -0
  24. local_notebooklm-0.5.2/pyproject.toml +43 -0
  25. local_notebooklm-0.5.2/requirements.txt +10 -0
  26. local_notebooklm-0.5.2/setup.cfg +4 -0
  27. local_notebooklm-0.5.2/setup.py +38 -0
@@ -0,0 +1,27 @@
1
+ # Include license and readme
2
+ include LICENSE
3
+ include README.md
4
+
5
+ # Include requirements files
6
+ include requirements.txt
7
+ include requirements-dev.txt
8
+
9
+ # Include documentation
10
+ recursive-include docs *
11
+
12
+ # Include examples
13
+ recursive-include examples *
14
+
15
+ # Include tests
16
+ recursive-include tests *
17
+
18
+ # Exclude development and CI/CD configurations
19
+ exclude .pre-commit-config.yaml
20
+ exclude .gitignore
21
+ recursive-exclude .github *
22
+
23
+ # Exclude cache files
24
+ global-exclude __pycache__/*
25
+ global-exclude *.py[cod]
26
+ global-exclude *.so
27
+ global-exclude .DS_Store
@@ -0,0 +1,383 @@
1
+ Metadata-Version: 2.2
2
+ Name: local_notebooklm
3
+ Version: 0.5.2
4
+ Summary: A local notebook implementation
5
+ Home-page: https://github.com/Goekdeniz-Guelmez/Local-NotebookLM
6
+ Author: Gökdeniz Gülmez
7
+ Author-email: Gökdeniz Gülmez <goekdenizguelmez@gmail.com>
8
+ License: Apache-2.0
9
+ Project-URL: Homepage, https://github.com/Goekdeniz-Guelmez//Local-NotebookLM
10
+ Project-URL: Bug Tracker, https://github.com/Goekdeniz-Guelmez//Local-NotebookLM/issues
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.12
15
+ Description-Content-Type: text/markdown
16
+ Dynamic: author
17
+ Dynamic: home-page
18
+ Dynamic: requires-python
19
+
20
+ # Local-NotebookLM
21
+
22
+ A local AI-powered tool that converts PDF documents into engaging podcasts, using local LLMs and TTS models.
23
+
24
+ ## Features
25
+
26
+ - PDF text extraction and processing
27
+ - Customizable podcast generation with different styles and lengths
28
+ - Support for various LLM providers (OpenAI, Groq, LMStudio, Ollama, Azure)
29
+ - Text-to-Speech conversion with voice selection
30
+ - Fully configurable pipeline
31
+ - Preference-based content focus
32
+ - Programmatic API for integration in other projects
33
+ - FastAPI server for web-based access
34
+ - Example podcast included for demonstration
35
+
36
+ ## Prerequisites
37
+
38
+ - Python 3.12+
39
+ - Local LLM server (optional, for local inference)
40
+ - Local TTS server (optional, for local audio generation)
41
+ - At least 8GB RAM (16GB+ recommended for local models)
42
+ - 10GB+ free disk space
43
+
44
+ ## Installation
45
+
46
+ ### From PyPI
47
+
48
+ ```bash
49
+ pip install Local-NotebookLM
50
+ ```
51
+
52
+ ### From source
53
+
54
+ 1. Clone the repository:
55
+
56
+ ```bash
57
+ git clone https://github.com/Goekdeniz-Guelmez/Local-NotebookLM.git
58
+ cd Local-NotebookLM
59
+ ```
60
+
61
+ 2. Create and activate a virtual environment (conda works too):
62
+
63
+ ```bash
64
+ python -m venv venv
65
+ source venv/bin/activate # On Windows, use: venv\Scripts\activate
66
+ ```
67
+
68
+ 3. Install the required packages:
69
+
70
+ ```bash
71
+ pip install -r requirements.txt
72
+ ```
73
+
74
+ ## Example Output
75
+
76
+ The repository includes an example podcast in `examples/podcast.wav` to demonstrate the quality and format of the output. The models used are: gpt4o and Mini with tts-hs on Azure. You can listen to this example to get a sense of what Local-NotebookLM can produce before running it on your own PDFs.
77
+
78
+ ## Configuration
79
+
80
+ You can use the default configuration or create a custom JSON config file with the following structure:
81
+
82
+ ```json
83
+ {
84
+ "Co-Host-Speaker-Voice": "af_sky+af_bella",
85
+ "Host-Speaker-Voice": "af_alloy",
86
+
87
+ "Small-Text-Model": {
88
+ "provider": {
89
+ "name": "groq",
90
+ "key": "your-api-key"
91
+ },
92
+ "model": "llama-3.2-90b-vision-preview"
93
+ },
94
+
95
+ "Big-Text-Model": {
96
+ "provider": {
97
+ "name": "groq",
98
+ "key": "your-api-key"
99
+ },
100
+ "model": "llama-3.2-90b-vision-preview"
101
+ },
102
+
103
+ "Text-To-Speech-Model": {
104
+ "provider": {
105
+ "name": "custom",
106
+ "endpoint": "http://localhost:8880/v1",
107
+ "key": "not-needed"
108
+ },
109
+ "model": "kokoro",
110
+ "audio_format": "wav"
111
+ },
112
+
113
+ "Step1": {
114
+ "max_tokens": 1028,
115
+ "temperature": 0.7,
116
+ "chunk_size": 1000,
117
+ "max_chars": 100000
118
+ },
119
+
120
+ "Step2": {
121
+ "max_tokens": 8126,
122
+ "temperature": 1,
123
+ "chunk_token_limit": 2000
124
+ },
125
+
126
+ "Step3": {
127
+ "max_tokens": 8126,
128
+ "temperature": 1,
129
+ "chunk_token_limit": 2000
130
+ }
131
+ }
132
+ ```
133
+
134
+ ### Provider Options
135
+
136
+ The following provider options are supported:
137
+
138
+ - **OpenAI**: Use OpenAI's API
139
+ ```json
140
+ "provider": {
141
+ "name": "openai",
142
+ "key": "your-openai-api-key"
143
+ }
144
+ ```
145
+
146
+ - **Groq**: Use Groq's API for faster inference
147
+ ```json
148
+ "provider": {
149
+ "name": "groq",
150
+ "key": "your-groq-api-key"
151
+ }
152
+ ```
153
+
154
+ - **Azure OpenAI**: Use Azure's OpenAI service
155
+ ```json
156
+ "provider": {
157
+ "name": "azure",
158
+ "key": "your-azure-api-key",
159
+ "endpoint": "your-azure-endpoint",
160
+ "version": "api-version"
161
+ }
162
+ ```
163
+
164
+ - **LMStudio**: Use a local LMStudio server
165
+ ```json
166
+ "provider": {
167
+ "name": "lmstudio",
168
+ "endpoint": "http://localhost:1234/v1",
169
+ "key": "not-needed"
170
+ }
171
+ ```
172
+
173
+ - **Ollama**: Use a local Ollama server
174
+ ```json
175
+ "provider": {
176
+ "name": "ollama",
177
+ "endpoint": "http://localhost:11434",
178
+ "key": "not-needed"
179
+ }
180
+ ```
181
+
182
+ - **Custom**: Use any OpenAI-compatible API
183
+ ```json
184
+ "provider": {
185
+ "name": "custom",
186
+ "endpoint": "your-custom-endpoint",
187
+ "key": "your-api-key-or-not-needed"
188
+ }
189
+ ```
190
+
191
+ ## Usage
192
+
193
+ ### Command Line Interface
194
+
195
+ Run the script with the following command:
196
+
197
+ ```bash
198
+ python -m local_notebooklm.start --pdf PATH_TO_PDF [options]
199
+ ```
200
+
201
+ #### Available Options
202
+
203
+ | Option | Description | Default |
204
+ |--------|-------------|---------|
205
+ | `--pdf` | Path to the PDF file (required) | - |
206
+ | `--config` | Path to custom config file | Uses base_config |
207
+ | `--format` | Output format type (summary, podcast, article, interview) | podcast |
208
+ | `--length` | Content length (short, medium, long, very-long) | medium |
209
+ | `--style` | Content style (normal, casual, formal, technical, academic) | normal |
210
+ | `--preference` | Additional focus preferences or instructions | None |
211
+ | `--output-dir` | Directory to store output files | ./output |
212
+
213
+ #### Example Commands
214
+
215
+ Basic usage:
216
+ ```bash
217
+ python -m local_notebooklm.start --pdf documents/research_paper.pdf
218
+ ```
219
+
220
+ Customized podcast:
221
+ ```bash
222
+ python -m local_notebooklm.start --pdf documents/research_paper.pdf --format podcast --length long --style casual
223
+ ```
224
+
225
+ With custom preferences:
226
+ ```bash
227
+ python -m local_notebooklm.start --pdf documents/research_paper.pdf --preference "Focus on practical applications and real-world examples"
228
+ ```
229
+
230
+ Using custom config:
231
+ ```bash
232
+ python -m local_notebooklm.start --pdf documents/research_paper.pdf --config custom_config.json --output-dir ./my_podcast
233
+ ```
234
+
235
+ ### Programmatic API
236
+
237
+ You can also use Local-NotebookLM programmatically in your Python code:
238
+
239
+ ```python
240
+ from local_notebooklm.processor import podcast_processor
241
+
242
+ success, result = podcast_processor(
243
+ pdf_path="documents/research_paper.pdf",
244
+ config_path="config.json",
245
+ format_type="interview",
246
+ length="long",
247
+ style="professional",
248
+ preference="Focus on the key technical aspects",
249
+ output_dir="./test_output"
250
+ )
251
+
252
+ if success:
253
+ print(f"Successfully generated podcast: {result}")
254
+ else:
255
+ print(f"Failed to generate podcast: {result}")
256
+ ```
257
+
258
+ ### FastAPI Server
259
+
260
+ Start the FastAPI server to access the functionality via a web API:
261
+
262
+ ```bash
263
+ python -m local_notebooklm.server
264
+ ```
265
+
266
+ By default, the server runs on http://localhost:8000. You can access the API documentation at http://localhost:8000/docs.
267
+
268
+ ## Pipeline Steps
269
+
270
+ ### 1. PDF Processing (Step1)
271
+ - Extracts text from PDF documents
272
+ - Cleans and formats the content
273
+ - Removes irrelevant elements like page numbers and headers
274
+ - Handles LaTeX math expressions and special characters
275
+ - Splits content into manageable chunks for processing
276
+
277
+ ### 2. Transcript Generation (Step2)
278
+ - Generates an initial podcast script based on the extracted content
279
+ - Applies the specified style (casual, formal, technical, academic)
280
+ - Formats content according to the desired length (short, medium, long, very-long)
281
+ - Structures content for a conversational format
282
+ - Incorporates user-specified format type (summary, podcast, article, interview)
283
+
284
+ ### 3. TTS Optimization (Step3)
285
+ - Rewrites content specifically for better text-to-speech performance
286
+ - Creates a two-speaker conversation format
287
+ - Adds speech markers and natural conversation elements
288
+ - Optimizes for natural flow and engagement
289
+ - Incorporates user preferences for content focus
290
+ - Formats output as a list of speaker-text tuples
291
+
292
+ ### 4. Audio Generation (Step4)
293
+ - Converts the optimized text to speech using the specified TTS model
294
+ - Applies different voices for each speaker
295
+ - Generates individual audio segments for each dialogue part
296
+ - Concatenates segments into a final audio file
297
+ - Maintains consistent audio quality and sample rate
298
+
299
+ ## Output Files
300
+
301
+ The pipeline generates the following files:
302
+
303
+ - `step1/extracted_text.txt`: Raw text extracted from the PDF
304
+ - `step1/clean_extracted_text.txt`: Cleaned and processed text
305
+ - `step2/data.pkl`: Initial transcript data
306
+ - `step3/podcast_ready_data.pkl`: TTS-optimized conversation data
307
+ - `step3/segments/podcast_segment_*.wav`: Individual audio segments
308
+ - `step3/podcast.wav`: Final concatenated podcast audio file
309
+
310
+ ## Troubleshooting
311
+
312
+ ### Common Issues
313
+
314
+ 1. **PDF Extraction Fails**
315
+ - Try a different PDF file
316
+ - Check if the PDF is password-protected
317
+ - Ensure the PDF contains extractable text (not just images)
318
+
319
+ 2. **API Connection Errors**
320
+ - Verify your API keys are correct
321
+ - Check your internet connection
322
+ - Ensure the API endpoints are accessible
323
+
324
+ 3. **Out of Memory Errors**
325
+ - Reduce the chunk size in the configuration
326
+ - Use a smaller model
327
+ - Close other memory-intensive applications
328
+
329
+ 4. **Audio Quality Issues**
330
+ - Try different TTS voices
331
+ - Adjust the sample rate in the configuration
332
+ - Check if the TTS server is running correctly
333
+
334
+ ### Getting Help
335
+
336
+ If you encounter issues not covered here, please:
337
+ 1. Check the logs for detailed error messages
338
+ 2. Open an issue on the GitHub repository with details about your problem
339
+ 3. Include the error message and steps to reproduce the issue
340
+
341
+ ## Requirements
342
+
343
+ - Python 3.12+
344
+ - PyPDF2
345
+ - tqdm
346
+ - numpy
347
+ - soundfile
348
+ - requests
349
+ - pathlib
350
+ - fastapi
351
+ - uvicorn
352
+
353
+ Full requirements are listed in `requirements.txt`.
354
+
355
+ ## Acknowledgments
356
+
357
+ - This project uses various open-source libraries and models
358
+ - Special thanks to the developers of LLaMA, OpenAI, and other AI models that make this possible
359
+
360
+ ---
361
+
362
+ For more information, visit the [GitHub repository](https://github.com/Goekdeniz-Guelmez/Local-NotebookLM).
363
+
364
+ Best
365
+ Gökdeniz Gülmez
366
+
367
+ ---
368
+
369
+ ## Citing Local-NotebookLM
370
+
371
+ The Local-NotebookLM software suite was developed by Gökdeniz Gülmez. If you find Local-NotebookLM useful in your research and wish to cite it, please use the following
372
+ BibTex entry:
373
+
374
+ ```text
375
+ @software{
376
+ Local-NotebookLM,
377
+ author = {Gökdeniz Gülmez},
378
+ title = {{Local-NotebookLM}: A Local-NotebookLM to convert PDFs into Audio.},
379
+ url = {https://github.com/Goekdeniz-Guelmez/Local-NotebookLM},
380
+ version = {0.1.5},
381
+ year = {2025},
382
+ }
383
+ ```