Spaces:
Build error
Build error
added specific versions to requirement file
Browse files117 unmodified lines1181191201211221231241251264 unmodified lines1311321331341351361371381391401411421431441451461471481491501511521531541551568 unmodified lines165166167168117 unmodified linesfile_path = pdf_name_withoutextension # Replace with your file pathdef get_file_content_as_bytes(path):with open(path, "rb") as file:return file.read()file_content = get_file_content_as_bytes(file_path)4 unmodified linesmime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')st.title('PDF to Excel Converter')uploaded_files = st.file_uploader("Choose files", accept_multiple_files=True)for uploaded_file in uploaded_files:if uploaded_file is not None:file_name = uploaded_file.name# Define the file path (current directory in this case)file_path = os.path.join(os.getcwd(), file_name)# Write the file to the current directorywith open(file_path, "wb") as f:f.write(uploaded_file.getbuffer())st.success(f'File "{file_name}" saved at "{file_path}"')excel_file = convert_pdf_to_excel(file_name)with open('./demo.css') as f:8 unmodified lines117 unmodified lines1181191201211221231244 unmodified lines1291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651668 unmodified lines175176177117 unmodified linesfile_path = pdf_name_withoutextension # Replace with your file pathfile_content = get_file_content_as_bytes(file_path)4 unmodified linesmime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')def get_file_content_as_bytes(path):with open(path, "rb") as file:return file.read()st.title('PDF to Excel Converter')uploaded_files = st.file_uploader("Choose files", accept_multiple_files=True)for uploaded_file in uploaded_files:if uploaded_file is not None:file_name = uploaded_file.name# Check if the file has already been processedif file_name not in st.session_state.processed_files:# Process the filefile_path = os.path.join(os.getcwd(), file_name)with open(file_path, "wb") as f:f.write(uploaded_file.getbuffer())st.success(f'File "{file_name}" saved at "{file_path}"')# Call your processing function hereexcel_file = convert_pdf_to_excel(file_name)# Update session state to indicate the file has been processedst.session_state.processed_files.append(file_name)# Provide download linkfile_content = get_file_content_as_bytes(file_path)st.download_button(label='Download Excel File',data=file_content,file_name=excel_file,mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')with open('./demo.css') as f:8 unmodified lines
app.py+24-15