Soumen commited on
Commit
cd370f7
1 Parent(s): 92953f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
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
- #text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
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
- img = Image.open(camera_photo)
120
- img = img.save("img.png")
121
- img = cv2.imread("img.png")
122
- text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
123
- st.success(text)
124
- elif uploaded_photo==None and camera_photo==None:
125
- #our_image=load_image("image.jpg")
126
- #img = cv2.imread("scholarly_text.jpg")
127
- text = message
 
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)