Kushwanth Chowday Kandala commited on
Commit
61c3232
1 Parent(s): ec7fc78

AttributeError: 'list' object has no attribute 'seek'

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -155,13 +155,13 @@ def combine_text(pages):
155
 
156
  def create_embeddings():
157
  # Get the uploaded file
158
- uploaded_file = st.session_state["uploaded_file"]
159
-
160
- # Read the contents of the file
161
- reader = PyPDF2.PdfReader(uploaded_file)
162
- pages = reader.pages
163
- print_out(pages)
164
- combine_text(pages)
165
 
166
  st.write("created_embeddings")
167
 
@@ -186,7 +186,7 @@ with st.sidebar:
186
  - Takes couple of mins after upload the pdf
187
  - Now Chat with model to get the summarized info or Generative reponse
188
  """)
189
- uploaded_files = st.file_uploader('Choose your .pdf file', type="pdf", accept_multiple_files=True, key="uploaded_file", on_change=create_embeddings)
190
  # for uploaded_file in uploaded_files:
191
  # To read file as bytes:
192
  # bytes_data = uploaded_file.getvalue()
@@ -203,6 +203,7 @@ with st.sidebar:
203
  # Can be used wherever a "file-like" object is accepted:
204
  # dataframe = pd.read_csv(uploaded_file)
205
  # st.write(dataframe)
 
206
  # reader = PyPDF2.PdfReader(uploaded_file)
207
  # pages = reader.pages
208
  # print_out(pages)
 
155
 
156
  def create_embeddings():
157
  # Get the uploaded file
158
+ uploaded_files = st.session_state["uploaded_files"]
159
+ for uploaded_file in uploaded_files:
160
+ # Read the contents of the file
161
+ reader = PyPDF2.PdfReader(uploaded_file)
162
+ pages = reader.pages
163
+ print_out(pages)
164
+ combine_text(pages)
165
 
166
  st.write("created_embeddings")
167
 
 
186
  - Takes couple of mins after upload the pdf
187
  - Now Chat with model to get the summarized info or Generative reponse
188
  """)
189
+ uploaded_files = st.file_uploader('Choose your .pdf file', type="pdf", accept_multiple_files=True, key="uploaded_files", on_change=create_embeddings)
190
  # for uploaded_file in uploaded_files:
191
  # To read file as bytes:
192
  # bytes_data = uploaded_file.getvalue()
 
203
  # Can be used wherever a "file-like" object is accepted:
204
  # dataframe = pd.read_csv(uploaded_file)
205
  # st.write(dataframe)
206
+
207
  # reader = PyPDF2.PdfReader(uploaded_file)
208
  # pages = reader.pages
209
  # print_out(pages)