Update app.py
Browse files
app.py
CHANGED
@@ -64,16 +64,18 @@ from PIL import Image
|
|
64 |
# all_page_text += text + " " #page.extractText()
|
65 |
# return all_page_text
|
66 |
def read_pdf_with_pdfplumber(file):
|
|
|
67 |
with pdfplumber.open(file) as pdf:
|
68 |
page = pdf.pages[0]
|
69 |
-
|
70 |
# get co-ordinates to cr
|
71 |
#img = Image.open(im)
|
72 |
img = page.save("img.png")
|
73 |
image_name = cv2.imread("img.png")
|
74 |
## get co-ordinates to cr
|
75 |
-
|
76 |
-
|
|
|
77 |
st.title("Streamlit NLP APP")
|
78 |
@st.experimental_singleton
|
79 |
def text_analyzer(my_text):
|
|
|
64 |
# all_page_text += text + " " #page.extractText()
|
65 |
# return all_page_text
|
66 |
def read_pdf_with_pdfplumber(file):
|
67 |
+
all_page_text=""
|
68 |
with pdfplumber.open(file) as pdf:
|
69 |
page = pdf.pages[0]
|
70 |
+
#return page.extract_text()
|
71 |
# get co-ordinates to cr
|
72 |
#img = Image.open(im)
|
73 |
img = page.save("img.png")
|
74 |
image_name = cv2.imread("img.png")
|
75 |
## get co-ordinates to cr
|
76 |
+
text = pytesseract.image_to_string(image_name, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(image_name)
|
77 |
+
all_page_text += text + " " #page.extractText()
|
78 |
+
return all_page_text
|
79 |
st.title("Streamlit NLP APP")
|
80 |
@st.experimental_singleton
|
81 |
def text_analyzer(my_text):
|