Soumen commited on
Commit
b3b4ade
·
1 Parent(s): 3390c89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -73,13 +73,13 @@ def bansum(text):
73
  st.success(text_output)
74
 
75
  st.title("Bangla and English Summarizer:")
76
- st.subheader("Please, upload your PDF/Images or input texts to summarize: ")
77
  #@st.cache_resource(experimental_allow_widgets=True)
78
  def main():
79
  """ NLP Based Application with Streamlit """
80
  def change_photo_state():
81
  st.session_state["photo"]="done"
82
- message = st.text_input("Type your text here!")
83
  uploaded_photo = st.sidebar.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
84
  camera_photo = st.sidebar.camera_input("Capture a photo to summarize: ", on_change=change_photo_state)
85
  if "photo" not in st.session_state:
@@ -92,14 +92,15 @@ def main():
92
  #image_result.write(file)
93
  tet = read_pdf(uploaded_photo)
94
  #tet = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
95
- values = st.slider('Select a approximate number of lines to see and summarize',value=[0, len(tet)//(7*100)])
96
  st.text("Selected text for summarize: ")
97
  if st.button("BENGALI"):
 
98
  text = tet[values[0]*7*10:values[1]*7*100] if values[0]!=len(tet)//(7*100) else tet[len(tet)//(7*100):]
99
  st.success(text)
100
  st.text("Summarized text: ")
101
  bansum(text)
102
  if st.button("ENGLISH"):
 
103
  text = tet[values[0]*7*10:values[1]*7*100] if values[0]!=len(tet)//(7*100) else tet[len(tet)//(7*100):]
104
  st.success(text)
105
  st.text("Summarized text: ")
 
73
  st.success(text_output)
74
 
75
  st.title("Bangla and English Summarizer:")
76
+ st.subheader("Input texts to summarize: ")
77
  #@st.cache_resource(experimental_allow_widgets=True)
78
  def main():
79
  """ NLP Based Application with Streamlit """
80
  def change_photo_state():
81
  st.session_state["photo"]="done"
82
+ message = st.sidebar.text_input("Type your text here!")
83
  uploaded_photo = st.sidebar.file_uploader("Upload your Images/PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
84
  camera_photo = st.sidebar.camera_input("Capture a photo to summarize: ", on_change=change_photo_state)
85
  if "photo" not in st.session_state:
 
92
  #image_result.write(file)
93
  tet = read_pdf(uploaded_photo)
94
  #tet = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
 
95
  st.text("Selected text for summarize: ")
96
  if st.button("BENGALI"):
97
+ values = st.slider('Select a approximate number of lines to see and summarize',value=[0, len(tet)//(7*100)])
98
  text = tet[values[0]*7*10:values[1]*7*100] if values[0]!=len(tet)//(7*100) else tet[len(tet)//(7*100):]
99
  st.success(text)
100
  st.text("Summarized text: ")
101
  bansum(text)
102
  if st.button("ENGLISH"):
103
+ values = st.slider('Select a approximate number of lines to see and summarize',value=[0, len(tet)//(7*100)])
104
  text = tet[values[0]*7*10:values[1]*7*100] if values[0]!=len(tet)//(7*100) else tet[len(tet)//(7*100):]
105
  st.success(text)
106
  st.text("Summarized text: ")