File size: 860 Bytes
415afc1
d7a232b
ec5938f
d7a232b
ec5938f
 
 
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
 
 
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
d7a232b
ec5938f
415afc1
 
d7a232b
ec5938f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import gradio as gr

from toshiba import extract_toshiba_data

from bhel import extract_bhel_data

def extract_data(pdf_file, company):

    if company == 'Toshiba':

        return extract_toshiba_data(pdf_file)

    elif company == 'BHEL':

        return extract_bhel_data(pdf_file)

    else:

        raise ValueError("Unsupported company format")

company_options = ['Toshiba', 'BHEL']

interface = gr.Interface(

    fn=extract_data,

    inputs=[gr.File(label="Upload PDF"), gr.Dropdown(choices=company_options, label="Select Company")],

    outputs=gr.File(label="Download Extracted Data as Excel"),

    title="PDF Data Extractor for Toshiba and BHEL",

    description="Upload a PDF file and select the company to extract and format data into an Excel file according to specific requirements."

)

if __name__ == "__main__":

    interface.launch()