Update app.py
Browse files
app.py
CHANGED
|
@@ -98,6 +98,7 @@ def read_pdf(file):
|
|
| 98 |
# return all_page_text
|
| 99 |
st.title("NLP APPLICATION")
|
| 100 |
#@st.cache_resource(experimental_allow_widgets=True)
|
|
|
|
| 101 |
def text_analyzer(my_text):
|
| 102 |
nlp = spacy.load('en_core_web_sm')
|
| 103 |
docx = nlp(my_text)
|
|
@@ -168,14 +169,14 @@ def main():
|
|
| 168 |
#ret,thresh1 = cv2.threshold(imge,120,255,cv2.THRESH_BINARY)
|
| 169 |
# pytesseract image to string to get results
|
| 170 |
#text = str(pytesseract.image_to_string(img, config='--psm 6',lang="ben")) if st.checkbox("Bangla") else str(pytesseract.image_to_string(thresh1, config='--psm 6'))
|
| 171 |
-
text = pytesseract.image_to_string(img) if st.checkbox("Mark
|
| 172 |
-
st.success(text)
|
| 173 |
elif camera_photo:
|
| 174 |
img = Image.open(camera_photo)
|
| 175 |
img = img.save("img.png")
|
| 176 |
img = cv2.imread("img.png")
|
| 177 |
-
text = pytesseract.image_to_string(img) if st.checkbox("Mark
|
| 178 |
-
st.success(text)
|
| 179 |
elif uploaded_photo==None and camera_photo==None:
|
| 180 |
#our_image=load_image("image.jpg")
|
| 181 |
#img = cv2.imread("scholarly_text.jpg")
|
|
|
|
| 98 |
# return all_page_text
|
| 99 |
st.title("NLP APPLICATION")
|
| 100 |
#@st.cache_resource(experimental_allow_widgets=True)
|
| 101 |
+
@st.experimental_singleton
|
| 102 |
def text_analyzer(my_text):
|
| 103 |
nlp = spacy.load('en_core_web_sm')
|
| 104 |
docx = nlp(my_text)
|
|
|
|
| 169 |
#ret,thresh1 = cv2.threshold(imge,120,255,cv2.THRESH_BINARY)
|
| 170 |
# pytesseract image to string to get results
|
| 171 |
#text = str(pytesseract.image_to_string(img, config='--psm 6',lang="ben")) if st.checkbox("Bangla") else str(pytesseract.image_to_string(thresh1, config='--psm 6'))
|
| 172 |
+
text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark for Bangla Image's Text") else pytesseract.image_to_string(img)
|
| 173 |
+
#st.success(text)
|
| 174 |
elif camera_photo:
|
| 175 |
img = Image.open(camera_photo)
|
| 176 |
img = img.save("img.png")
|
| 177 |
img = cv2.imread("img.png")
|
| 178 |
+
text = pytesseract.image_to_string(img) if st.checkbox("Mark for Bangla Image's Text") else pytesseract.image_to_string(img, lang="ben")
|
| 179 |
+
#st.success(text)
|
| 180 |
elif uploaded_photo==None and camera_photo==None:
|
| 181 |
#our_image=load_image("image.jpg")
|
| 182 |
#img = cv2.imread("scholarly_text.jpg")
|