Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Upload PDF from Local to Document AI

Hello everyone. I now create a web app and I want to ask about how to upload PDFs from my laptop/local to Document AI?

 

with open(file_path, "rb") as image:
       image_content = image.read()
 
uploaded_file = st.file_uploader('Choose your .pdf file', type="pdf")
 
process_document_sample(
     project_id="XXXX",
     location="us",
     processor_id="XXX",
     file_path=uploaded_file,
     mime_type="application/pdf"
)
I want upload PDF from local/my laptop use Streamlit (uploaded_file) and can read my PDF with with open(file_path, "rb") as image function?
0 1 1,573
1 REPLY 1