File size: 1,355 Bytes
37746c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

# Placeholder function for PO extraction
# Replace this with the actual logic for processing the selected format
def process_format(format_name):
    # Simulated logic for different formats
    if format_name == "BHEL.py":
        return "Processing in BHEL.py format..."
    elif format_name == "Federal Electric.py":
        return "Processing in Federal Electric.py format..."
    elif format_name == "AL-NISF":
        return "Processing in AL-NISF format..."
    else:
        return "Unknown format selected."

# Define the dropdown options
format_options = ["BHEL.py", "Federal Electric.py", "AL-NISF"]

# Build the Gradio app
def app():
    dropdown = gr.Dropdown(
        choices=format_options,
        label="Select Format",
        value="BHEL.py",  # Default value
        interactive=True,
    )

    output = gr.Textbox(label="Result", interactive=False)

    # Update function to display result based on selected format
    def update(format_name):
        return process_format(format_name)

    interface = gr.Interface(
        fn=update,
        inputs=dropdown,
        outputs=output,
        title="PO Extraction Format Selector",
        description="Select the desired format from the dropdown, and the app will process accordingly."
    )

    return interface

if __name__ == "__main__":
    app().launch()