Upload images to cloud and then paste the respective link to a respective dataframe

99 views Asked by At

I've PDFs with tables and the image diagram related to the content of tables. Both, table and image on a single page.

I've extracted the Tables using the Camelot library. And also images using Fitz library. Using Python

Now I want to upload those images(.png) to any possible cloud service and provide the web link of the respective image to the Dataframe of the respective table.

Please help.

This is how a single Page of PDF looks line.

1

There are 1 answers

0
jgrt On BEST ANSWER

In case of any public cloud, you can use S3 to store images using BOTO3 (python library).

sample code to store images in AWS S3 bucket:

import boto3
s3 = boto3.client('s3')
bucket = 'your-bucket-name'
file_name = 'location-of-your-image'
key_name = 'name-of-image-in-s3'
s3.upload_file(file_name, bucket, key_name)

To obtain the uploaded file url, you can construct it as:

s3_url = f"https://{bucket}.s3.{region}.amazonaws.com/{file_name}"

and store s3_url in dataframe.