Spaces:
Sleeping
Sleeping
coldn00dl3s
commited on
Commit
•
a41afe1
1
Parent(s):
40645ff
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
|
|
3 |
import requests
|
4 |
import json
|
5 |
from datetime import datetime
|
6 |
-
import
|
7 |
|
8 |
st.title("FHIR Converter")
|
9 |
|
@@ -125,10 +125,10 @@ elif conversion_type == "Clinical Notes to FHIR":
|
|
125 |
if uploaded_pdf is not None and st.button("Convert"):
|
126 |
try:
|
127 |
# Extract text from PDF
|
128 |
-
pdf_reader =
|
129 |
paragraphs = []
|
130 |
-
for page_num in range(pdf_reader.
|
131 |
-
page = pdf_reader.
|
132 |
text = page.extract_text()
|
133 |
paragraphs.extend(text.split("\n\n")) # Split by double newline for paragraph separation
|
134 |
|
|
|
3 |
import requests
|
4 |
import json
|
5 |
from datetime import datetime
|
6 |
+
from PyPDF2 import PdfReader
|
7 |
|
8 |
st.title("FHIR Converter")
|
9 |
|
|
|
125 |
if uploaded_pdf is not None and st.button("Convert"):
|
126 |
try:
|
127 |
# Extract text from PDF
|
128 |
+
pdf_reader = PdfReader(uploaded_pdf)
|
129 |
paragraphs = []
|
130 |
+
for page_num in range(len(pdf_reader.pages)):
|
131 |
+
page = pdf_reader.pages[page_num]
|
132 |
text = page.extract_text()
|
133 |
paragraphs.extend(text.split("\n\n")) # Split by double newline for paragraph separation
|
134 |
|