coldn00dl3s commited on
Commit
a41afe1
1 Parent(s): 40645ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
3
  import requests
4
  import json
5
  from datetime import datetime
6
- import PyPDF2
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 = PyPDF2.PdfFileReader(uploaded_pdf)
129
  paragraphs = []
130
- for page_num in range(pdf_reader.getNumPages()):
131
- page = pdf_reader.getPage(page_num)
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