Spaces:
Running
Running
import gradio as gr | |
import PyPDF2 | |
def extract_text_from_pdf(pdf): | |
with open(pdf, 'rb') as pdf_file: | |
pdf_reader = PyPDF2.PdfFileReader(pdf_file) | |
text = '' | |
for page in range(pdf_reader.numPages): | |
text += pdf_reader.getPage(page).extractText() | |
return text | |
iface = gr.Interface(fn=extract_text_from_pdf, inputs="file", outputs="text") | |
iface.launch() | |