Spaces:
Sleeping
Sleeping
th8m0z
commited on
Commit
•
c16c062
1
Parent(s):
b5ac495
cleaned up code
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +0 -3
__pycache__/app.cpython-311.pyc
CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -52,18 +52,15 @@ def text_to_chunks(texts, word_length=150, start_page=1, file_number=1):
|
|
52 |
chunk = ' '.join(chunk).strip()
|
53 |
chunk = f'[PDF no. {file_number}] [Page no. {idx+start_page}]' + ' ' + '"' + chunk + '"'
|
54 |
chunks.append(chunk)
|
55 |
-
# print("chunks == " + str(chunks))
|
56 |
return chunks
|
57 |
|
58 |
|
59 |
# merges a list of pdfs into a list of chunks and fits the recommender
|
60 |
def load_recommender(paths, start_page=1):
|
61 |
global recommender
|
62 |
-
texts = []
|
63 |
chunks = []
|
64 |
for idx, path in enumerate(paths):
|
65 |
chunks += text_to_chunks(pdf_to_text(path, start_page=start_page), start_page=start_page, file_number=idx+1)
|
66 |
-
# print("chunks == " + str(chunks))
|
67 |
recommender.fit(chunks)
|
68 |
return 'Corpus Loaded.'
|
69 |
|
|
|
52 |
chunk = ' '.join(chunk).strip()
|
53 |
chunk = f'[PDF no. {file_number}] [Page no. {idx+start_page}]' + ' ' + '"' + chunk + '"'
|
54 |
chunks.append(chunk)
|
|
|
55 |
return chunks
|
56 |
|
57 |
|
58 |
# merges a list of pdfs into a list of chunks and fits the recommender
|
59 |
def load_recommender(paths, start_page=1):
|
60 |
global recommender
|
|
|
61 |
chunks = []
|
62 |
for idx, path in enumerate(paths):
|
63 |
chunks += text_to_chunks(pdf_to_text(path, start_page=start_page), start_page=start_page, file_number=idx+1)
|
|
|
64 |
recommender.fit(chunks)
|
65 |
return 'Corpus Loaded.'
|
66 |
|