Spaces:
Sleeping
Sleeping
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", | |
"APFO": "Adjusted Profit from Operations", | |
"LEP": "Limited Edition Pack", | |
"AD": "Area Director", | |
"LT": "Leadership Team", | |
"OLT": "Operations Leadership Team", | |
"MLT": "Marketing Leadership Team", | |
"FLT": "Finance Leadership Team", | |
"GSD": "Group Service Delivery or Global Service Desk", | |
"TPD": "Tobacco Products Directive", | |
"WMS": "Warehouse Management System / Wrapping Material Specification", | |
"GLT": "Green Leaf Threshing", | |
"MBL": "Modern BAT Leaf", | |
"TAO": "One SAP", | |
"PLM": "Product Lifecycle Management", | |
"PMD": "Primary Manufacturing Unit", | |
"SMD": "Secondary Manufacturing Unit", | |
"SLA": "Service Level Agreement", | |
"Coco": "Consumer Complaint", | |
"Cuco": "Customer Complaint", | |
"Osso": "Operation Skill Sourcing Officer", | |
"Moso": "Marketing Skill Sourcing Manager", | |
"FT": "Field Technician", | |
"STT": "Sales to Trade", | |
"ADS": "Average Daily Sales", | |
"RA": "Retailers Assistant", | |
"SR": "Sales Representative", | |
"VBB": "Valuable Business Partner", | |
"MT": "Modern Trade", | |
"BCP": "Business Continuity Planning", | |
"ABC": "Activity Based Costing", | |
"ABD": "Advance Booking Deadlines", | |
"AC": "Assessment Centre", | |
"ACA": "Area Cycle Alignment", | |
"ACF": "Active Charcoal Filter", | |
"ACT": "Advance Corporation Tax", | |
"ADR": "American Depositary Receipts", | |
"Ad-valorem": "Type of tobacco taxation typically calculated on the value of cigarettes sold", | |
"ADW": "Active Data Warehouse", | |
"AGV": "Automated Guided Vehicle", | |
"AIR": "Average Issue Readership", | |
"AIT": "Anti Illicit Trade", | |
"ALPS": "Area Leaf Planning System", | |
"AME": "Achieving Marketing Excellence database / Africa Middle East (region)", | |
"AMGP": "Additives and Material Guidance Panel", | |
"AO": "Area Office", | |
"AP": "Accounts Payable", | |
"APO": "Advanced Planner & Optimiser", | |
"APS": "Advanced Planning System / Annual Planning System", | |
"APV": "Accounts Payable Voucher", | |
"AR": "Accounts Receivable", | |
"ASH": "Action on Smoking and Health", | |
"ASP": "Aspirational Premium", | |
"ASPAC": "Asia Pacific (Region)", | |
"ASU30": "Adult Smoker Under 30 Years Old", | |
"AT": "Account Teams", | |
"ATC": "Advanced Technologies Cambridge", | |
"ATIF": "Any Time In Full", | |
"ATL": "Above The Line (traditional media advertising term)", | |
"AV": "Ad Valorem", | |
"AWAP": "Above Weighted Average Price", | |
"B2B": "Business to Business", | |
"B2C": "Business to Consumer", | |
"BA": "Business Analyst", | |
"BASS": "British American Shared Services", | |
"BAT": "British American Tobacco", | |
"BATMark": "Trademark Department", | |
"BATPS": "British American Tobacco Pension Scheme", | |
"BAU": "Business as Usual", | |
"BCC": "Board Compensation Committee", | |
"BCM": "Business Change Manager / Business Continuity Management", | |
"BCP": "Business Continuity Plan", | |
"BCT": "Business Controls Team", | |
"BDD": "Business Development Department", | |
"BEL": "Business Excellence for Leaders", | |
"BESS": "Brand Excellence Series", | |
"BEST": "Business Enablers Survey Tool", | |
"BIA": "Business Impact Analysis", | |
"BIB": "Blend In a Box", | |
"BIM": "Brand Image Mapping / Business Implementation Manager", | |
"BLM": "Brand Launch & Modification", | |
"BLT": "BATCCA Leadership Team", | |
"BM": "Brand Manager", | |
"BMF": "Brand Modification Form", | |
"Bn": "Billion", | |
"BOD": "Bill Of Distribution", | |
"BOL": "Bill Of Lending", | |
"BOM": "Bill Of Materials", | |
"BOSS": "Business and Operational System Steering Group", | |
"BPCS": "Business Planning & Control System (Integrated AS400 computer system)", | |
"BPI": "Business Process Improvement", | |
"BPO": "Business Process Outsourcing", | |
"BPR": "Business Process Re-engineering", | |
"BPTO": "Brand Price Trade – Off", | |
"BritAm": "The name of the proprietary typeface designed specifically for the British American Tobacco logotype in our corporate signature", | |
"BRM": "Budget Review Meeting", | |
"BRR": "Business Risk Register", | |
"BS": "Balance Sheet", | |
"BSE": "Brand Support Expenditure", | |
"BSU": "Business Support Unit", | |
"BT": "British Telecoms", | |
"BTC": "British American Tobacco Technology Centre", | |
"BTL": "Below The Line (Traditional merchandising/promotions)", | |
"BVS": "Brand Value Segment", | |
"BW": "Business Warehouse", | |
"BWAP": "Below Weighted Average Price", | |
"BY": "Burley", | |
} | |
# 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 knowledge base" | |
return response | |
# Create the Gradio interface | |
iface = gr.Interface( | |
fn=chatbot_interface, | |
inputs="text", | |
outputs="text", | |
title="BATB Acronym Finder", | |
description="Enter an acronym to find its abbreviation in the knowledge base.", | |
theme='default' | |
) | |
# Launch the interface | |
iface.launch() | |