Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def pdf_to_text(path, start_page=1, end_page=None):
|
|
43 |
text_len = text_len + word_count0(text)
|
44 |
doc.close()
|
45 |
print(text_len)
|
46 |
-
if(text_len>
|
47 |
pdf_parse_status = 0
|
48 |
return [], pdf_parse_status
|
49 |
return text_list, pdf_parse_status
|
@@ -69,9 +69,7 @@ def text_to_chunks(texts, word_length=150, start_page=1):
|
|
69 |
chunk = f'[Page no. {idx+start_page}]' + ' ' + '"' + chunk + '"'
|
70 |
chunks.append(chunk)
|
71 |
text_len = text_len + word_count0(chunk)
|
72 |
-
|
73 |
-
pdf_parse_status = 0
|
74 |
-
# return [], pdf_parse_status
|
75 |
return chunks
|
76 |
|
77 |
|
|
|
43 |
text_len = text_len + word_count0(text)
|
44 |
doc.close()
|
45 |
print(text_len)
|
46 |
+
if(text_len>2000):
|
47 |
pdf_parse_status = 0
|
48 |
return [], pdf_parse_status
|
49 |
return text_list, pdf_parse_status
|
|
|
69 |
chunk = f'[Page no. {idx+start_page}]' + ' ' + '"' + chunk + '"'
|
70 |
chunks.append(chunk)
|
71 |
text_len = text_len + word_count0(chunk)
|
72 |
+
|
|
|
|
|
73 |
return chunks
|
74 |
|
75 |
|