text: from logging import NullHandler
  from pdf2docx import Converter
  import  streamlit as st
  from pdf2docx import parse
  import base64
  
  uploaded_file = st.file_uploader(label="请上传PDF文件",type="pdf")
  docx_file = "./sample.docx"
  #parse(uploaded_file, docx_file)
  if uploaded_file is not None:
      with st.expander("查看PDF文件"):
          base64_pdf = base64.b64encode(uploaded_file.read()).decode('utf-8')
          pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf">' 
          st.markdown(pdf_display, unsafe_allow_html=True)
      cv = Converter(base64_pdf)
      docx_file = cv.convert( start=0, end=None)
      st.download_button(label="转换完成，请下载docx文件",data=docx_file,file_name="sample.docx")
  
  
  
  
  
  
  
  
  
  # with st.empty():
  #     if uploaded_file is not None:
  #         parse(uploaded_file, docx_file)
  #         st.download_button(label="转换完成，请下载docx文件",data=docx_file,file_name="sample.docx")
  
  