Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -121,16 +121,14 @@ def process_pdf(path):
|
|
| 121 |
# print(result_section1_dict)
|
| 122 |
return result_section1_dict['TOPIC']
|
| 123 |
|
| 124 |
-
"""
|
| 125 |
def get_first_page_text(path):
|
| 126 |
doc = pdfplumber.open(io.BytesIO(path))
|
| 127 |
if len(doc.pages):
|
| 128 |
return doc.pages[0].extract_text()
|
| 129 |
-
"""
|
| 130 |
|
| 131 |
# Define the Gradio interface
|
| 132 |
-
|
| 133 |
-
iface = gr.Interface(fn=process_pdf,
|
| 134 |
inputs=gr.File(type="binary", label="Upload PDF"),
|
| 135 |
outputs=gr.Textbox(label="Extracted Text"),
|
| 136 |
title="PDF Text Extractor",
|
|
|
|
| 121 |
# print(result_section1_dict)
|
| 122 |
return result_section1_dict['TOPIC']
|
| 123 |
|
|
|
|
| 124 |
def get_first_page_text(path):
|
| 125 |
doc = pdfplumber.open(io.BytesIO(path))
|
| 126 |
if len(doc.pages):
|
| 127 |
return doc.pages[0].extract_text()
|
|
|
|
| 128 |
|
| 129 |
# Define the Gradio interface
|
| 130 |
+
iface = gr.Interface(fn=get_first_page_text,
|
| 131 |
+
#iface = gr.Interface(fn=process_pdf,
|
| 132 |
inputs=gr.File(type="binary", label="Upload PDF"),
|
| 133 |
outputs=gr.Textbox(label="Extracted Text"),
|
| 134 |
title="PDF Text Extractor",
|