Soumen commited on
Commit
c2639e9
·
1 Parent(s): 3a5002a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -89,7 +89,6 @@ def bansum(text):
89
  st.title("NLP APPLICATION")
90
  #@st.cache_resource(experimental_allow_widgets=True)
91
  def main():
92
- b=0
93
  #global tokenizer, model
94
  #tokenizer = AutoTokenizer.from_pretrained('t5-base')
95
  #model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)
@@ -103,7 +102,7 @@ def main():
103
  st.session_state["photo"]="done"
104
  st.subheader("Please, feed your pdf/images/text, features/services will appear automatically!")
105
  message = st.text_input("Type your text here!")
106
- uploaded_photo = st.file_uploader("Upload your PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
107
  camera_photo = st.camera_input("Take a photo, Containing English texts", on_change=change_photo_state)
108
  if "photo" not in st.session_state:
109
  st.session_state["photo"]="not done"
@@ -135,10 +134,8 @@ def main():
135
  # pytesseract image to string to get results
136
  #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'))
137
  if st.checkbox("Bangla"):
138
- b=1
139
  text = pytesseract.image_to_string(img, lang="ben")
140
  else:
141
- b=0
142
  text=pytesseract.image_to_string(img)
143
  #st.success(text)
144
  elif camera_photo:
@@ -147,10 +144,8 @@ def main():
147
  img = cv2.imread("img.png")
148
  #text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
149
  if st.checkbox("Bangla"):
150
- b=1
151
  text = pytesseract.image_to_string(img, lang="ben")
152
  else:
153
- b=0
154
  text=pytesseract.image_to_string(img)
155
  #st.success(text)
156
  elif uploaded_photo==None and camera_photo==None:
@@ -172,7 +167,7 @@ def main():
172
  st.success(text_output)
173
 
174
  if st.checkbox("Mark for Text Summarization"):
175
- if b==1:
176
  bansum(text)
177
  else:
178
  engsum(text)
 
89
  st.title("NLP APPLICATION")
90
  #@st.cache_resource(experimental_allow_widgets=True)
91
  def main():
 
92
  #global tokenizer, model
93
  #tokenizer = AutoTokenizer.from_pretrained('t5-base')
94
  #model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)
 
102
  st.session_state["photo"]="done"
103
  st.subheader("Please, feed your pdf/images/text, features/services will appear automatically!")
104
  message = st.text_input("Type your text here!")
105
+ uploaded_photo = st.sidebar.file_uploader("Upload your PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
106
  camera_photo = st.camera_input("Take a photo, Containing English texts", on_change=change_photo_state)
107
  if "photo" not in st.session_state:
108
  st.session_state["photo"]="not done"
 
134
  # pytesseract image to string to get results
135
  #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'))
136
  if st.checkbox("Bangla"):
 
137
  text = pytesseract.image_to_string(img, lang="ben")
138
  else:
 
139
  text=pytesseract.image_to_string(img)
140
  #st.success(text)
141
  elif camera_photo:
 
144
  img = cv2.imread("img.png")
145
  #text = pytesseract.image_to_string(img) if st.checkbox("Bangla") else pytesseract.image_to_string(img, lang="ben")
146
  if st.checkbox("Bangla"):
 
147
  text = pytesseract.image_to_string(img, lang="ben")
148
  else:
 
149
  text=pytesseract.image_to_string(img)
150
  #st.success(text)
151
  elif uploaded_photo==None and camera_photo==None:
 
167
  st.success(text_output)
168
 
169
  if st.checkbox("Mark for Text Summarization"):
170
+ if st.checkbox("Bangla")
171
  bansum(text)
172
  else:
173
  engsum(text)