Soumen commited on
Commit
2bfe916
·
1 Parent(s): 6f995cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -124,7 +124,7 @@ def main():
124
  st.session_state["photo"]="not done"
125
  if st.session_state["photo"]=="done" or message:
126
  text=" "
127
- if uploaded_photo.type=='application/pdf':
128
  #file = uploaded_photo.read() # Read the data
129
  #image_result = open(uploaded_photo.name, 'wb') # creates a writable image and later we can write the decoded result
130
  #image_result.write(file)
@@ -133,7 +133,7 @@ def main():
133
  values = st.slider('Select a approximate number of lines to see and summarize',value=[0, len(tet)//(7*10)])
134
  text = tet[values[0]*7*10:values[1]*7*10] if values[0]!=len(tet)//(7*10) else tet[len(tet)//(7*10):]
135
  st.success(text)
136
- if uploaded_photo.type == "application/image":
137
  img = Image.open(uploaded_photo)
138
  img = img.save("img.png")
139
  img = cv2.imread("img.png")
 
124
  st.session_state["photo"]="not done"
125
  if st.session_state["photo"]=="done" or message:
126
  text=" "
127
+ if uploaded_photo and uploaded_photo.type=='application/pdf':
128
  #file = uploaded_photo.read() # Read the data
129
  #image_result = open(uploaded_photo.name, 'wb') # creates a writable image and later we can write the decoded result
130
  #image_result.write(file)
 
133
  values = st.slider('Select a approximate number of lines to see and summarize',value=[0, len(tet)//(7*10)])
134
  text = tet[values[0]*7*10:values[1]*7*10] if values[0]!=len(tet)//(7*10) else tet[len(tet)//(7*10):]
135
  st.success(text)
136
+ elif uploaded_photo and uploaded_photo.type != "application/pdf":
137
  img = Image.open(uploaded_photo)
138
  img = img.save("img.png")
139
  img = cv2.imread("img.png")