Spaces:
Runtime error
Runtime error
Updated ignore file and corrected error on start and stop pages in app.py
Browse files- .gitignore +4 -4
- app.py +6 -0
.gitignore
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
appOLD.py
|
5 |
Clinical_Trial_Project.pages
|
6 |
testing.ipynb
|
7 |
-
.chainlit
|
8 |
-
.files
|
9 |
-
__pycache__
|
10 |
-
documents
|
|
|
4 |
appOLD.py
|
5 |
Clinical_Trial_Project.pages
|
6 |
testing.ipynb
|
7 |
+
.chainlit
|
8 |
+
.files
|
9 |
+
__pycache__
|
10 |
+
documents
|
app.py
CHANGED
@@ -30,17 +30,23 @@ async def on_chat_start():
|
|
30 |
doc = pymupdf.Document(file.path)
|
31 |
toc = doc.get_toc()
|
32 |
# Want to find the List Of Figures page because that is the last page I want to skip
|
|
|
|
|
33 |
for _, title, page in toc:
|
34 |
if title == "List of Figures":
|
35 |
print(f"{title} on page {page}")
|
36 |
start_page = page + 1
|
37 |
|
|
|
38 |
# get the last page I want included
|
|
|
|
|
39 |
for _, title, page in toc:
|
40 |
if ("References" in title) or ("Bibliography" in title):
|
41 |
print(f"{title} on page {page}")
|
42 |
end_page = page
|
43 |
|
|
|
44 |
print(f"Extraction should start on page {start_page} and end on page {end_page}")
|
45 |
|
46 |
|
|
|
30 |
doc = pymupdf.Document(file.path)
|
31 |
toc = doc.get_toc()
|
32 |
# Want to find the List Of Figures page because that is the last page I want to skip
|
33 |
+
# Default is 1 if I do not find better start location
|
34 |
+
start_page = 1
|
35 |
for _, title, page in toc:
|
36 |
if title == "List of Figures":
|
37 |
print(f"{title} on page {page}")
|
38 |
start_page = page + 1
|
39 |
|
40 |
+
|
41 |
# get the last page I want included
|
42 |
+
# default is last page of document
|
43 |
+
end_page = len(doc)
|
44 |
for _, title, page in toc:
|
45 |
if ("References" in title) or ("Bibliography" in title):
|
46 |
print(f"{title} on page {page}")
|
47 |
end_page = page
|
48 |
|
49 |
+
|
50 |
print(f"Extraction should start on page {start_page} and end on page {end_page}")
|
51 |
|
52 |
|