Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
"
|
| 12 |
-
"
|
| 13 |
-
"
|
| 14 |
-
"EOB"
|
| 15 |
-
"OOO"
|
| 16 |
}
|
| 17 |
|
| 18 |
# Define the Gradio interface function
|
| 19 |
def chatbot_interface(acronym):
|
| 20 |
-
acronym = acronym.strip().
|
| 21 |
-
if
|
| 22 |
response = f"Answer: {knowledge_base[acronym]}"
|
| 23 |
else:
|
| 24 |
response = "Not found in the BATCCAPEDIA"
|
| 25 |
return response
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
| 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 |
-
|
|
|
|
| 40 |
title="BATB Acronym Finder",
|
| 41 |
description="Dictionary of Abbreviations & Acronyms",
|
| 42 |
theme='default',
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
|
|
|
|
|