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()