File size: 1,473 Bytes
de0b504
 
 
 
 
 
 
387af10
de0b504
 
 
387af10
 
 
 
de0b504
 
387af10
 
 
 
 
 
 
eab11b1
 
387af10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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",
    "AD": "Area Director",
    "IDT" : "Information & Digital Technology",
    "CORA" : "Corporate & Regulatory Affairs",    
    "EOB" : "End of Business Day",
    "OOO" :"Out of Office",
}

# Define the Gradio interface function
def chatbot_interface(acronym):
    acronym = acronym.strip().toUpperCase()  # 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

# HTML code to add the logo
header_html = """
<div style="text-align: center; margin-bottom: 20px;">
    <img src="https://www.batbangladesh.com/imgs/BAT_Bangladesh_Logo.png" alt="BAT Bangladesh Logo" style="max-width: 200px;">
</div>
"""

# Create the Gradio interface
iface = gr.Interface(
    fn=chatbot_interface,
    inputs="text",
    outputs="text",
    css="footer{display:none !important}",
    title="BATB Acronym Finder",
    description="Dictionary of Abbreviations & Acronyms",
    theme='default',
    header_html=header_html
)

# Launch the interface
iface.launch()