File size: 1,500 Bytes
de0b504
 
 
 
 
 
 
e02a626
de0b504
 
e02a626
 
 
 
 
de0b504
 
387af10
 
e02a626
 
387af10
 
 
eab11b1
 
e02a626
 
387af10
 
 
 
e02a626
 
387af10
 
 
e02a626
 
 
 
 
387af10
e02a626
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
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