Spaces:
Sleeping
Sleeping
Update rag_module.py
Browse files- rag_module.py +0 -14
rag_module.py
CHANGED
|
@@ -41,21 +41,7 @@ class RagModule():
|
|
| 41 |
self.temperature = 0.1
|
| 42 |
|
| 43 |
|
| 44 |
-
def read_pdf_file(self, file):
|
| 45 |
-
"""read pdf file
|
| 46 |
|
| 47 |
-
Args:
|
| 48 |
-
file (_type_): _description_
|
| 49 |
-
|
| 50 |
-
Returns:
|
| 51 |
-
_type_: _description_
|
| 52 |
-
"""
|
| 53 |
-
pdf = PyPDF2.PdfReader(file.path)
|
| 54 |
-
pdf_text = ""
|
| 55 |
-
for page in pdf.pages:
|
| 56 |
-
pdf_text += page.extract_text()
|
| 57 |
-
|
| 58 |
-
return pdf_text
|
| 59 |
|
| 60 |
def split_text(self, text:str) -> list:
|
| 61 |
"""Split the text into chunk
|
|
|
|
| 41 |
self.temperature = 0.1
|
| 42 |
|
| 43 |
|
|
|
|
|
|
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def split_text(self, text:str) -> list:
|
| 47 |
"""Split the text into chunk
|