SarowarSaurav commited on
Commit
e02a626
1 Parent(s): 387af10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -21
app.py CHANGED
@@ -5,43 +5,40 @@ knowledge_base = {
5
  "SOP": "Sales Operations Planning / Standard Operational Procedure / Start of Production",
6
  "NTO": "Net Turnover",
7
  "D&A": "Data & Analytics",
8
- "HOF":"Head of Function",
9
  "APFO": "Adjusted Profit from Operations",
10
  "LEP": "Limited Edition Pack",
11
- "AD": "Area Director",
12
- "IDT" : "Information & Digital Technology",
13
- "CORA" : "Corporate & Regulatory Affairs",
14
- "EOB" : "End of Business Day",
15
- "OOO" :"Out of Office",
16
  }
17
 
18
  # Define the Gradio interface function
19
  def chatbot_interface(acronym):
20
- acronym = acronym.strip().toUpperCase() # Remove leading/trailing whitespace and convert to uppercase
21
- if (acronym in knowledge_base):
22
  response = f"Answer: {knowledge_base[acronym]}"
23
  else:
24
  response = "Not found in the BATCCAPEDIA"
25
  return response
26
 
27
- # HTML code to add the logo
28
- header_html = """
29
- <div style="text-align: center; margin-bottom: 20px;">
30
- <img src="https://www.batbangladesh.com/imgs/BAT_Bangladesh_Logo.png" alt="BAT Bangladesh Logo" style="max-width: 200px;">
31
- </div>
32
- """
33
-
34
- # Create the Gradio interface
35
  iface = gr.Interface(
36
  fn=chatbot_interface,
37
  inputs="text",
38
  outputs="text",
39
- css="footer{display:none !important}",
 
40
  title="BATB Acronym Finder",
41
  description="Dictionary of Abbreviations & Acronyms",
42
  theme='default',
43
- header_html=header_html
 
 
 
 
44
  )
45
-
46
- # Launch the interface
47
- iface.launch()
 
5
  "SOP": "Sales Operations Planning / Standard Operational Procedure / Start of Production",
6
  "NTO": "Net Turnover",
7
  "D&A": "Data & Analytics",
8
+ "HOF": "Head of Function",
9
  "APFO": "Adjusted Profit from Operations",
10
  "LEP": "Limited Edition Pack",
11
+ "ISC": "Integrated Supply Chain",
12
+ "ISF": "In Store Furniture",
13
+ "PED": "Primary Engineering Department",
14
+ "EOB": "End of Business Day",
15
+ "OOO": "Out of Office",
16
  }
17
 
18
  # Define the Gradio interface function
19
  def chatbot_interface(acronym):
20
+ acronym = acronym.strip().upper() # Remove leading/trailing whitespace and convert to uppercase
21
+ if acronym in knowledge_base:
22
  response = f"Answer: {knowledge_base[acronym]}"
23
  else:
24
  response = "Not found in the BATCCAPEDIA"
25
  return response
26
 
27
+ # Create the Gradio interface with the logo
28
+ logo_url = "https://www.batbangladesh.com/imgs/BAT_Bangladesh_Logo.png"
 
 
 
 
 
 
29
  iface = gr.Interface(
30
  fn=chatbot_interface,
31
  inputs="text",
32
  outputs="text",
33
+ live=True, # Add a live preview for logo positioning
34
+ css="footer{display:none !important} #img-overlay { position: fixed; top: 10px; right: 10px; z-index: 100; }",
35
  title="BATB Acronym Finder",
36
  description="Dictionary of Abbreviations & Acronyms",
37
  theme='default',
38
+ examples=[
39
+ ["SOP"],
40
+ ["NTO"],
41
+ ["D&A"],
42
+ ],
43
  )
44
+ iface.launch(inline=False, share=True) # Launch the interface