DSatishchandra commited on
Commit
c485eb1
·
verified ·
1 Parent(s): eb27df4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -13,14 +13,23 @@ def process_file(pdf_file, extractor):
13
  Returns:
14
  The extracted file and status message.
15
  """
16
- if extractor == "ALNISF":
17
- return process_alnisf(pdf_file)
18
- elif extractor == "Federal Electric":
19
- return process_federal_electric(pdf_file)
20
- elif extractor == "BHEL":
21
- return process_bhel(pdf_file)
22
- else:
23
- return None, "Invalid extractor selected."
 
 
 
 
 
 
 
 
 
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():