File size: 4,612 Bytes
720d849
a1a13bb
06675a6
 
 
720d849
 
 
 
 
06675a6
720d849
 
06675a6
 
 
 
 
 
 
720d849
 
a1a13bb
 
06675a6
 
 
 
 
 
 
 
 
 
720d849
 
 
 
8b27fa0
720d849
 
a1a13bb
 
 
 
 
 
720d849
 
 
 
8b27fa0
 
720d849
 
 
 
06675a6
720d849
 
 
 
a693669
720d849
 
8b27fa0
 
720d849
a1a13bb
 
720d849
 
 
06675a6
 
 
 
964980b
 
 
 
 
 
06675a6
 
 
 
 
 
 
 
 
 
964980b
 
06675a6
 
 
964980b
06675a6
 
 
 
 
 
 
720d849
 
 
 
06675a6
720d849
 
 
 
 
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import gradio as gr
from pipeline import extract_info_batch, extract_reimbursement_form_info, extract_medical_info, extract_medical_info_batch
from PIL import Image





with gr.Blocks() as demo:
    with gr.Tabs():
        with gr.Tab("Receipts Upload"):
            with gr.Row():
                with gr.Column(scale=2):
                    batch_img_input = gr.File(
                        file_types=["image"],
                        label="Batch Image Upload",
                        elem_id="batch-upload-img",
                        show_label=True,
                        file_count="multiple"
                    )

                with gr.Column(scale=2):
                    gr.Markdown("## Receipt Reimbursement Portal")

                    batch_output_box = gr.Markdown(
                        value="Upload Images to extract information",
                        label="Batch Extracted Info",
                        elem_id="batch-output-box",
                        show_label=True
                    )
                    batch_img_input.change(
                        fn=extract_info_batch,
                        inputs=batch_img_input,
                        outputs=batch_output_box
                    )
        


        with gr.Tab("Reimbursement Forms"):
            with gr.Row():
                with gr.Column(scale=2):
                    reimbursement_img_input = gr.File(
                        file_types=["image"],
                        label="Batch Image Upload",
                        elem_id="batch-upload-img",
                        show_label=True,
                        file_count="multiple"
                    )

                with gr.Column(scale=2):
                    # Dropdown for form names
                    gr.Markdown("## Reimbursement Forms")
                    form_name = gr.Dropdown(choices=["Child Fee Reimbursement Form", "Internet Charges Form", "Mobile Reimbursement Form"], interactive=True, multiselect=False)
                    
                    # 2x2 grid for info fields
                    with gr.Row():
                        emp_name = gr.Textbox(label="Employee Name")
                
                        emp_code = gr.Textbox(label="Employee Code")
                    with gr.Row():
                        department = gr.Textbox(label="Department")
                    upload_btn = gr.Button("Upload and Process")
                    preview_output = gr.File(label="Download Filled Form")




                    upload_btn.click(
                        fn=extract_reimbursement_form_info,
                        inputs=[reimbursement_img_input, emp_name, emp_code, department,form_name],
                        outputs=preview_output
                    )

       
        with gr.Tab("Medical Reimbursement Form"):
            with gr.Row():
                with gr.Column(scale=2):
                    medical_img_input = gr.File(
                        label="Upload Medical Form Images (Multiple Allowed)",
                        file_count="multiple",
                        file_types=["image"],
                        elem_id="medical-upload-img-batch",
                        show_label=True
                    )
                with gr.Column(scale=2):
                    with gr.Row():
                        med_company_name = gr.Dropdown(choices=["NetSol Technologies Ltd.","NetSol Innovation Private Ltd."], interactive=True, multiselect=False)
                        med_emp_name = gr.Textbox(label="Employee Name")
                        med_department = gr.Textbox(label="Department")
                    with gr.Row():
                        med_designation = gr.Textbox(label="Designation")
                        med_ext_code = gr.Textbox(label="Extention No.")
                        med_emp_code = gr.Textbox(label="Employee Code")
                    medical_upload_btn = gr.Button("Upload and Process Batch")
                    preview_medical_output = gr.File(label="Download Consolidated Form (HTML)")

                    
                    medical_upload_btn.click(
                        fn=extract_medical_info_batch,
                        inputs=[medical_img_input,med_emp_name,med_emp_code,med_department,med_designation,med_company_name,med_ext_code],
                        outputs=preview_medical_output
                    )




    # CSS:
    gr.HTML("""
        <style>
        #output-box .prose, #output-box .prose pre, #output-box .prose code {
            font-size: 30px !important;
        }
        </style>
    """)

demo.launch()