Soumen commited on
Commit
c6ec27d
·
1 Parent(s): 63c9540

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -84,7 +84,7 @@ def read_pdf(file):
84
  # 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)
85
  # all_page_text += text + " " #page.extractText()
86
  # return all_page_text
87
- st.title("Streamlit NLP APP")
88
  @st.experimental_singleton
89
  def text_analyzer(my_text):
90
  nlp = spacy.load('en_core_web_sm')
@@ -151,13 +151,13 @@ def main():
151
  #ret,thresh1 = cv2.threshold(imge,120,255,cv2.THRESH_BINARY)
152
  # pytesseract image to string to get results
153
  #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'))
154
- text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
155
  st.success(text)
156
  elif camera_photo:
157
  img = Image.open(camera_photo)
158
  img = img.save("img.png")
159
  img = cv2.imread("img.png")
160
- text = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
161
  st.success(text)
162
  elif uploaded_photo==None and camera_photo==None:
163
  #our_image=load_image("image.jpg")
@@ -185,7 +185,7 @@ def main():
185
  # st.success(message)
186
  # summary_result = summarize(text)
187
  # st.success(summary_result)
188
- if st.checkbox("Mark to better English Text Summarization!"):
189
  #st.title("Summarize Your Text for English only!")
190
  tokenizer = AutoTokenizer.from_pretrained('t5-base')
191
  model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)
 
84
  # 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)
85
  # all_page_text += text + " " #page.extractText()
86
  # return all_page_text
87
+ st.title("NLP APPLICATION")
88
  @st.experimental_singleton
89
  def text_analyzer(my_text):
90
  nlp = spacy.load('en_core_web_sm')
 
151
  #ret,thresh1 = cv2.threshold(imge,120,255,cv2.THRESH_BINARY)
152
  # pytesseract image to string to get results
153
  #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'))
154
+ text = pytesseract.image_to_string(img) #pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else
155
  st.success(text)
156
  elif camera_photo:
157
  img = Image.open(camera_photo)
158
  img = img.save("img.png")
159
  img = cv2.imread("img.png")
160
+ text = pytesseract.image_to_string(img) #pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
161
  st.success(text)
162
  elif uploaded_photo==None and camera_photo==None:
163
  #our_image=load_image("image.jpg")
 
185
  # st.success(message)
186
  # summary_result = summarize(text)
187
  # st.success(summary_result)
188
+ if st.checkbox("Mark to English Text Summarization!"):
189
  #st.title("Summarize Your Text for English only!")
190
  tokenizer = AutoTokenizer.from_pretrained('t5-base')
191
  model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)