Update app.py
Browse files
app.py
CHANGED
@@ -103,11 +103,10 @@ def main():
|
|
103 |
uploaded_photo = st.file_uploader("Upload Image, Containing English or Bangla texts",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
104 |
if "photo" not in st.session_state:
|
105 |
st.session_state["photo"]="not done"
|
106 |
-
|
107 |
-
if st.session_state["photo"]=="done" or message:
|
108 |
if st.button("Process_PDF"):
|
109 |
text = read_pdf(uploaded_photo)
|
110 |
-
|
111 |
st.success(text)
|
112 |
if uploaded_photo and uploaded_photo.type != "application/pdf":
|
113 |
img = Image.open(uploaded_photo)
|
@@ -116,15 +115,16 @@ def main():
|
|
116 |
text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
|
117 |
st.success(text)
|
118 |
elif camera_photo:
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
128 |
if st.checkbox("Show Named Entities English/Bangla"):
|
129 |
entity_result = entity_analyzer(text)
|
130 |
st.json(entity_result)
|
|
|
103 |
uploaded_photo = st.file_uploader("Upload Image, Containing English or Bangla texts",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
104 |
if "photo" not in st.session_state:
|
105 |
st.session_state["photo"]="not done"
|
106 |
+
if st.session_state["photo"]=="done" or message:
|
|
|
107 |
if st.button("Process_PDF"):
|
108 |
text = read_pdf(uploaded_photo)
|
109 |
+
#text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
|
110 |
st.success(text)
|
111 |
if uploaded_photo and uploaded_photo.type != "application/pdf":
|
112 |
img = Image.open(uploaded_photo)
|
|
|
115 |
text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
|
116 |
st.success(text)
|
117 |
elif camera_photo:
|
118 |
+
img = Image.open(camera_photo)
|
119 |
+
img = img.save("img.png")
|
120 |
+
img = cv2.imread("img.png")
|
121 |
+
text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
|
122 |
+
st.success(text)
|
123 |
+
elif uploaded_photo==None and camera_photo==None:
|
124 |
+
#our_image=load_image("image.jpg")
|
125 |
+
#img = cv2.imread("scholarly_text.jpg")
|
126 |
+
text = message
|
127 |
+
if st.checkbox("Show)
|
128 |
if st.checkbox("Show Named Entities English/Bangla"):
|
129 |
entity_result = entity_analyzer(text)
|
130 |
st.json(entity_result)
|