Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,10 +6,10 @@ from datasets import DatasetDict, Dataset
|
|
6 |
|
7 |
# Função para extrair texto do PDF
|
8 |
def extract_text_from_pdf(pdf_file):
|
9 |
-
reader = PyPDF2.
|
10 |
text = ""
|
11 |
-
for page in
|
12 |
-
text +=
|
13 |
return text
|
14 |
|
15 |
# Função para gerar perguntas e respostas usando o pipeline da Hugging Face
|
@@ -61,4 +61,4 @@ with gr.Blocks() as demo:
|
|
61 |
|
62 |
process_button.click(fn=process_pdf, inputs=[pdf_file, file_name], outputs=download_link)
|
63 |
|
64 |
-
demo.launch()
|
|
|
6 |
|
7 |
# Função para extrair texto do PDF
|
8 |
def extract_text_from_pdf(pdf_file):
|
9 |
+
reader = PyPDF2.PdfReader(pdf_file)
|
10 |
text = ""
|
11 |
+
for page in reader.pages:
|
12 |
+
text += page.extract_text()
|
13 |
return text
|
14 |
|
15 |
# Função para gerar perguntas e respostas usando o pipeline da Hugging Face
|
|
|
61 |
|
62 |
process_button.click(fn=process_pdf, inputs=[pdf_file, file_name], outputs=download_link)
|
63 |
|
64 |
+
demo.launch()
|