Soumen commited on
Commit
cd4b5cc
·
1 Parent(s): a4a5da7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -106,21 +106,21 @@ def main():
106
 
107
  if st.session_state["photo"]=="done" or message:
108
  if uploaded_photo:
109
- if uploaded_photo.type == "application/pdf":
110
- text = read_pdf(docx_file)
111
- text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
112
- else:
113
- img = Image.open(uploaded_photo)
114
- img = img.save("img.png")
115
- img = cv2.imread("img.png")
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")
 
106
 
107
  if st.session_state["photo"]=="done" or message:
108
  if uploaded_photo:
109
+ if uploaded_photo.type == "application/pdf":
110
+ text = read_pdf(docx_file)
111
+ text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
112
+ else:
113
+ img = Image.open(uploaded_photo)
114
+ img = img.save("img.png")
115
+ img = cv2.imread("img.png")
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")