Spaces:
Runtime error
Runtime error
neerajkalyank
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from toshiba import extract_toshiba_data
|
3 |
+
from bhel import extract_bhel_data
|
4 |
+
|
5 |
+
def extract_data(pdf_file, company):
|
6 |
+
if company == 'Toshiba':
|
7 |
+
return extract_toshiba_data(pdf_file)
|
8 |
+
elif company == 'BHEL':
|
9 |
+
return extract_bhel_data(pdf_file)
|
10 |
+
else:
|
11 |
+
raise ValueError("Unsupported company format")
|
12 |
+
|
13 |
+
company_options = ['Toshiba', 'BHEL']
|
14 |
+
interface = gr.Interface(
|
15 |
+
fn=extract_data,
|
16 |
+
inputs=[gr.File(label="Upload PDF"), gr.Dropdown(choices=company_options, label="Select Company")],
|
17 |
+
outputs=gr.File(label="Download Extracted Data as Excel"),
|
18 |
+
title="PDF Data Extractor for Toshiba and BHEL",
|
19 |
+
description="Upload a PDF file and select the company to extract and format data into an Excel file according to specific requirements."
|
20 |
+
)
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
+
interface.launch()
|