Soumen commited on
Commit
4f3134d
·
1 Parent(s): 9f43588

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -85,6 +85,7 @@ def main():
85
  st.session_state["photo"]="not done"
86
  if st.session_state["photo"]=="done" or message:
87
  if uploaded_photo and uploaded_photo.type=='application/pdf':
 
88
  #file = uploaded_photo.read() # Read the data
89
  #image_result = open(uploaded_photo.name, 'wb') # creates a writable image and later we can write the decoded result
90
  #image_result.write(file)
@@ -95,8 +96,10 @@ def main():
95
  text = tet[values[0]*7*10:values[1]*7*10] if values[0]!=len(tet)//(7*10) else tet[len(tet)//(7*100):]
96
  if st.checkbox("Show the selected text:"):
97
  st.success(text)
 
98
  engsum(text)
99
- if uploaded_photo:
 
100
  img = Image.open(uploaded_photo)
101
  img = img.save("img.png")
102
  img = cv2.imread("img.png")
@@ -109,6 +112,7 @@ def main():
109
  engsum(text)
110
  #st.success(text)
111
  if camera_photo:
 
112
  img = Image.open(camera_photo)
113
  img = img.save("img.png")
114
  img = cv2.imread("img.png")
@@ -121,6 +125,7 @@ def main():
121
  text=pytesseract.image_to_string(img)
122
  engsum(text)
123
  if message:
 
124
  text = message
125
  if st.button("Bangla"):
126
  bansum(text)
 
85
  st.session_state["photo"]="not done"
86
  if st.session_state["photo"]=="done" or message:
87
  if uploaded_photo and uploaded_photo.type=='application/pdf':
88
+ text=None
89
  #file = uploaded_photo.read() # Read the data
90
  #image_result = open(uploaded_photo.name, 'wb') # creates a writable image and later we can write the decoded result
91
  #image_result.write(file)
 
96
  text = tet[values[0]*7*10:values[1]*7*10] if values[0]!=len(tet)//(7*10) else tet[len(tet)//(7*100):]
97
  if st.checkbox("Show the selected text:"):
98
  st.success(text)
99
+ st.text("summarized text: ")
100
  engsum(text)
101
+ if uploaded_photo and uploaded_photo.type !='application/pdf':
102
+ text=None
103
  img = Image.open(uploaded_photo)
104
  img = img.save("img.png")
105
  img = cv2.imread("img.png")
 
112
  engsum(text)
113
  #st.success(text)
114
  if camera_photo:
115
+ text=None
116
  img = Image.open(camera_photo)
117
  img = img.save("img.png")
118
  img = cv2.imread("img.png")
 
125
  text=pytesseract.image_to_string(img)
126
  engsum(text)
127
  if message:
128
+ text=None
129
  text = message
130
  if st.button("Bangla"):
131
  bansum(text)