Closed Julian-Cao closed 1 year ago
I tried using multi-threading to do this. It didn't help much because there is a limit in API call rate currently.
It should be 60 requests per minute using the text-bison model. why does it so easily reach the limit? could you please share your code snippet?
Just checked with the team internally. They will release an official way to do it soon. We should just wait for it.
https://github.com/GoogleCloudPlatform/generative-ai/blob/main/language/examples/document-summarization/summarization_large_documents.ipynb
Read the PDF file and create a list of pages
reader = PyPDF2.PdfReader(pdf_file) pages = reader.pages
Create an empty list to store the summaries
initial_summary = []
Iterate over the pages and generate a summary for each page
for page in tqdm(pages):
it should be a sync code to run one after one. how to make it in parallel?