Spaces:
Sleeping
Sleeping
DSatishchandra
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -13,14 +13,23 @@ def process_file(pdf_file, extractor):
|
|
13 |
Returns:
|
14 |
The extracted file and status message.
|
15 |
"""
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
# Gradio interface setup
|
26 |
def create_main_interface():
|
|
|
13 |
Returns:
|
14 |
The extracted file and status message.
|
15 |
"""
|
16 |
+
try:
|
17 |
+
if extractor == "ALNISF":
|
18 |
+
output_file, status = process_alnisf(pdf_file)
|
19 |
+
elif extractor == "Federal Electric":
|
20 |
+
output_file, status = process_federal_electric(pdf_file)
|
21 |
+
elif extractor == "BHEL":
|
22 |
+
output_file, status = process_bhel(pdf_file)
|
23 |
+
else:
|
24 |
+
return None, "Invalid extractor selected."
|
25 |
+
|
26 |
+
# Validate the output
|
27 |
+
if not output_file:
|
28 |
+
return None, "Processing failed. Please ensure the PDF file is valid."
|
29 |
+
|
30 |
+
return output_file, status
|
31 |
+
except Exception as e:
|
32 |
+
return None, f"An error occurred: {str(e)}"
|
33 |
|
34 |
# Gradio interface setup
|
35 |
def create_main_interface():
|