#π PDF
17 messages Β· Page 1 of 1 (latest)
@sleek agate
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
What do you mean by "review a PDF"?
I want the program to be able to pull questions and answers from the text in the pdf
As in, the PDF already contains questions and answers that you want to extract?
Or you want a program that generates questions and answers based on content in the pdf
I want it to generate questions and answers
That's a pretty non-trivial task, but with the advent of LLMs you can probably do it
First, you need to extract the text from the PDF, depending on the PDF you might be able to use some libraries to take it straight from the file, this library looks like an okay one https://github.com/jsvine/pdfplumber
Alternatively you could run it through some OCR service, not sure if there are any that run locally but Google cloud has a decent one
Then you want to generate questions and answers, just feed the text of the PDF into openai with your prompt and you're done
OCR? I will look it up. I have to create questions weekly and looking for an easier way to do this while learning python
OCR just means 'optical character recognition', i.e. getting text out of an image
Depending on the PDF file, it might be hard to extract text from the file directly, so you'll need something like OCR instead
It might be possible to pass the PDF file to the LLM directly, e.g. https://platform.openai.com/docs/assistants/tools/file-search/how-it-works
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.