Update app.py
Browse files
app.py
CHANGED
|
@@ -120,9 +120,6 @@ def main():
|
|
| 120 |
message = st.text_input("Type your text here!")
|
| 121 |
camera_photo = st.camera_input("Take a photo, Containing English or Bangla texts", on_change=change_photo_state)
|
| 122 |
uploaded_photo = st.file_uploader("Upload Bangla or English Image/ English PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
| 123 |
-
if st.button("REFRESH"):
|
| 124 |
-
st.experimental_rerun()
|
| 125 |
-
|
| 126 |
if "photo" not in st.session_state:
|
| 127 |
st.session_state["photo"]="not done"
|
| 128 |
if st.session_state["photo"]=="done" or message:
|
|
@@ -135,16 +132,13 @@ def main():
|
|
| 135 |
#tet = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
|
| 136 |
values = st.slider('Select a approximate number of words to view and summarize', 0, 500,1000)
|
| 137 |
tl = len(tet)
|
|
|
|
| 138 |
if values:
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
text = tet[i*(values*5):] if i==tl//(values*5) else tet[i*(values*5):(i+1)*(values*5)]
|
| 145 |
-
i+=1
|
| 146 |
-
st.success(text)
|
| 147 |
-
#st.experimental_rerun()
|
| 148 |
|
| 149 |
elif uploaded_photo.type != "application/image":
|
| 150 |
img = Image.open(uploaded_photo)
|
|
|
|
| 120 |
message = st.text_input("Type your text here!")
|
| 121 |
camera_photo = st.camera_input("Take a photo, Containing English or Bangla texts", on_change=change_photo_state)
|
| 122 |
uploaded_photo = st.file_uploader("Upload Bangla or English Image/ English PDF",type=['jpg','png','jpeg','pdf'], on_change=change_photo_state)
|
|
|
|
|
|
|
|
|
|
| 123 |
if "photo" not in st.session_state:
|
| 124 |
st.session_state["photo"]="not done"
|
| 125 |
if st.session_state["photo"]=="done" or message:
|
|
|
|
| 132 |
#tet = pytesseract.image_to_string(img, lang="ben") if st.checkbox("Mark to see Bangla Image's Text") else pytesseract.image_to_string(img)
|
| 133 |
values = st.slider('Select a approximate number of words to view and summarize', 0, 500,1000)
|
| 134 |
tl = len(tet)
|
| 135 |
+
i=0
|
| 136 |
if values:
|
| 137 |
+
if st.button("See_Next"):
|
| 138 |
+
if i<=tl//(values*5):
|
| 139 |
+
text = tet[i*(values*5):] if i==tl//(values*5) else tet[i*(values*5):(i+1)*(values*5)]
|
| 140 |
+
i+=1
|
| 141 |
+
st.success(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
elif uploaded_photo.type != "application/image":
|
| 144 |
img = Image.open(uploaded_photo)
|