Spaces:
Sleeping
Sleeping
DSatishchandra
commited on
Update bhel.py
Browse files
bhel.py
CHANGED
@@ -97,6 +97,18 @@ def gradio_interface(pdf_file):
|
|
97 |
"""
|
98 |
return extract_data(pdf_file.name)
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
# Define Gradio interface
|
101 |
interface = gr.Interface(
|
102 |
fn=gradio_interface,
|
|
|
97 |
"""
|
98 |
return extract_data(pdf_file.name)
|
99 |
|
100 |
+
def process_pdf(file):
|
101 |
+
try:
|
102 |
+
# Extract text from the PDF
|
103 |
+
text = extract_text_from_pdf(file)
|
104 |
+
|
105 |
+
# Process the extracted text
|
106 |
+
output_path = extract_data(file.name)
|
107 |
+
return output_path, "Data extraction successful!"
|
108 |
+
except Exception as e:
|
109 |
+
return None, f"Error during processing: {str(e)}"
|
110 |
+
|
111 |
+
|
112 |
# Define Gradio interface
|
113 |
interface = gr.Interface(
|
114 |
fn=gradio_interface,
|