import gradio as gr # Define the knowledge base as a dictionary knowledge_base = { "SOP": "Sales Operations Planning / Standard Operational Procedure / Start of Production", "NTO": "Net Turnover", "D&A": "Data & Analytics", "HOF": "Head of Function", "APFO": "Adjusted Profit from Operations", "LEP": "Limited Edition Pack", "ISC": "Integrated Supply Chain", "ISF": "In Store Furniture", "PED": "Primary Engineering Department", "EOB": "End of Business Day", "OOO": "Out of Office", } # Define the Gradio interface function def chatbot_interface(acronym): acronym = acronym.strip().upper() # Remove leading/trailing whitespace and convert to uppercase if acronym in knowledge_base: response = f"Answer: {knowledge_base[acronym]}" else: response = "Not found in the BATCCAPEDIA" return response # Create the Gradio interface with the logo logo_url = "https://www.batbangladesh.com/imgs/BAT_Bangladesh_Logo.png" iface = gr.Interface( fn=chatbot_interface, inputs="text", outputs="text", live=True, # Add a live preview for logo positioning css="footer{display:none !important} #img-overlay { position: fixed; top: 10px; right: 10px; z-index: 100; }", title="BATB Acronym Finder", description="Dictionary of Abbreviations & Acronyms", theme='default', examples=[ ["SOP"], ["NTO"], ["D&A"], ], ) iface.launch(inline=False, share=True) # Launch the interface