text: from logging import NullHandler
  from pdf2docx import Converter
  import  streamlit as st
  from pdf2docx import parse
  import base64
  import time
  import tempfile
  from pathlib import Path
  from functions import *
  #from extractPic import pdf2pic
  
  
  timestr = time.strftime("%Y%m%d-%H%M%S")
  def get_binary_file_downloader_html(bin_file, file_label='File'):
      with open(bin_file, 'rb') as f:
          data = f.read()
      bin_str = base64.b64encode(data).decode('utf-8')
      href = f'<a href="data:application/octet-stream;base64,{bin_str}" download="{os.path.basename(bin_file)}">点击下载 {file_label}</a>'
      return href
  st.title("PDF file uplodaer")
  uploaded_file = st.file_uploader(label="",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)
          file_details = {"filename":uploaded_file.name, "filetype":uploaded_file.type,
                                  "filesize":uploaded_file.size}
          st.write(file_details)
          st.write(uploaded_file.name)
          #save_uploadedfile(uploaded_file)
  
      href=get_binary_file_downloader_html(uploaded_file, file_label='File')
      # cv = Converter("uploaded_file.name")
  