Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -112,12 +112,18 @@ def get_first_page_text(file_data):
|
|
| 112 |
if len(doc.pages):
|
| 113 |
return doc.pages[0].extract_text()
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
| 118 |
inputs=gr.File(type="binary", label="Upload PDF"),
|
| 119 |
outputs=gr.Textbox(label="Extracted Text"),
|
| 120 |
title="PDF Text Extractor",
|
| 121 |
description="Upload a PDF file to extract.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
iface.launch()
|
|
|
|
| 112 |
if len(doc.pages):
|
| 113 |
return doc.pages[0].extract_text()
|
| 114 |
|
| 115 |
+
if __name__ == "__main__":
|
| 116 |
+
|
| 117 |
+
# Define the Gradio interface
|
| 118 |
+
# iface = gr.Interface(fn=process_pdf,
|
| 119 |
+
demo = gr.Interface(fn=get_first_page_text,
|
| 120 |
inputs=gr.File(type="binary", label="Upload PDF"),
|
| 121 |
outputs=gr.Textbox(label="Extracted Text"),
|
| 122 |
title="PDF Text Extractor",
|
| 123 |
description="Upload a PDF file to extract.")
|
| 124 |
+
demo.launch()
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
|
|
|