SarowarSaurav commited on
Commit
eab11b1
·
verified ·
1 Parent(s): 50bcc23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +200 -706
app.py CHANGED
@@ -1,725 +1,219 @@
1
  import gradio as gr
2
- from flask import Flask, render_template_string, request, jsonify
3
 
4
  # Define the knowledge base as a dictionary
5
  knowledge_base = {
6
  "SOP": "Sales Operations Planning / Standard Operational Procedure / Start of Production",
7
  "NTO": "Net Turnover",
8
  "D&A": "Data & Analytics",
9
- "HOF":"Head of Function",
10
  "APFO": "Adjusted Profit from Operations",
11
  "LEP": "Limited Edition Pack",
12
  "AD": "Area Director",
13
- "IDT" : "Information & Digital Technology",
14
- "CORA" : "Corporate & Regulatory Affairs",
15
- "DBS" : "Digital Business Solutions",
16
- "MKT":"Marketing",
17
- "PAM":"Primary Area Management",
18
- "LT": "Leadership Team",
19
- "OLT": "Operations Leadership Team",
20
- "MLT": "Marketing Leadership Team",
21
- "FLT": "Finance Leadership Team",
22
- "GSD": "Group Service Delivery or Global Service Desk",
23
- "TPD": "Tobacco Products Directive",
24
- "WMS": "Warehouse Management System / Wrapping Material Specification",
25
- "GLT": "Green Leaf Threshing",
26
- "MBL": "Modern BAT Leaf",
27
- "TAO": "One SAP",
28
- "SOBC":"Standards of Business Conduct",
29
- "FMD": "Final Manufacturing Unit",
30
- "SSO":"Single Sign-on",
31
- "PLM": "Product Lifecycle Management",
32
- "PMD": "Primary Manufacturing Unit",
33
- "SMD": "Secondary Manufacturing Unit",
34
- "SLA": "Service Level Agreement",
35
- "CUCO": "Consumer Complaint",
36
- "COCO": "Customer Complaint",
37
- "EFO" : "End Fall-Out",
38
- "OSSO": "Operation Skill Sourcing Officer",
39
- "MSSO": "Marketing Skill Sourcing Manager",
40
- "FT": "Field Technician",
41
- "STT": "Sales to Trade",
42
- "ADS": "Average Daily Sales",
43
- "RA": "Retailers Assistant",
44
- "SR": "Sales Representative",
45
- "VBB": "Valuable Business Partner",
46
- "MT": "Modern Trade",
47
- "BCP": "Business Continuity Planning",
48
- "ABC": "Activity Based Costing",
49
- "ABD": "Advance Booking Deadlines",
50
- "AC": "Assessment Centre",
51
- "ACA": "Area Cycle Alignment",
52
- "ACF": "Active Charcoal Filter",
53
- "ACT": "Advance Corporation Tax",
54
- "ADR": "American Depositary Receipts",
55
- "Ad-valorem": "Type of tobacco taxation typically calculated on the value of cigarettes sold",
56
- "ADW": "Active Data Warehouse",
57
- "AGV": "Automated Guided Vehicle",
58
- "AIR": "Average Issue Readership",
59
- "AIT": "Anti Illicit Trade",
60
- "ALPS": "Area Leaf Planning System",
61
- "AME": "Achieving Marketing Excellence database / Africa Middle East (region)",
62
- "AMGP": "Additives and Material Guidance Panel",
63
- "AO": "Area Office",
64
- "AP": "Accounts Payable",
65
- "APO": "Advanced Planner & Optimiser",
66
- "APS": "Advanced Planning System / Annual Planning System",
67
- "APV": "Accounts Payable Voucher",
68
- "AR": "Accounts Receivable",
69
- "ASH": "Action on Smoking and Health",
70
- "ASP": "Aspirational Premium",
71
- "ASPAC": "Asia Pacific (Region)",
72
- "ASU30": "Adult Smoker Under 30 Years Old",
73
- "AT": "Account Teams",
74
- "ATC": "Advanced Technologies Cambridge",
75
- "ATIF": "Any Time In Full",
76
- "ATL": "Above The Line (traditional media advertising term)",
77
- "AV": "Ad Valorem",
78
- "AWAP": "Above Weighted Average Price",
79
- "B2B": "Business to Business",
80
- "B2C": "Business to Consumer",
81
- "BA": "Business Analyst",
82
- "BASS": "British American Shared Services",
83
- "BAT": "British American Tobacco",
84
- "BATMark": "Trademark Department",
85
- "BATPS": "British American Tobacco Pension Scheme",
86
- "BAU": "Business as Usual",
87
- "BCC": "Board Compensation Committee",
88
- "BCM": "Business Change Manager / Business Continuity Management",
89
- "BCP": "Business Continuity Plan",
90
- "BCT": "Business Controls Team",
91
- "BDD": "Business Development Department",
92
- "BEL": "Business Excellence for Leaders",
93
- "BESS": "Brand Excellence Series",
94
- "BEST": "Business Enablers Survey Tool",
95
- "BIA": "Business Impact Analysis",
96
- "BIB": "Blend In a Box",
97
- "BIM": "Brand Image Mapping / Business Implementation Manager",
98
- "BLM": "Brand Launch & Modification",
99
- "BLT": "BATCCA Leadership Team",
100
- "BM": "Brand Manager",
101
- "BMF": "Brand Modification Form",
102
- "Bn": "Billion",
103
- "BOD": "Bill Of Distribution",
104
- "BOL": "Bill Of Lending",
105
- "BOM": "Bill Of Materials",
106
- "BOSS": "Business and Operational System Steering Group",
107
- "BPCS": "Business Planning & Control System (Integrated AS400 computer system)",
108
- "BPI": "Business Process Improvement",
109
- "BPO": "Business Process Outsourcing",
110
- "BPR": "Business Process Re-engineering",
111
- "BPTO": "Brand Price Trade – Off",
112
- "BritAm": "The name of the proprietary typeface designed specifically for the British American Tobacco logotype in our corporate signature",
113
- "BRM": "Budget Review Meeting",
114
- "BRR": "Business Risk Register",
115
- "BS": "Balance Sheet",
116
- "BSE": "Brand Support Expenditure",
117
- "BSU": "Business Support Unit",
118
- "BT": "British Telecoms",
119
- "BTC": "British American Tobacco Technology Centre",
120
- "BTL": "Below The Line (Traditional merchandising/promotions)",
121
- "BVS": "Brand Value Segment",
122
- "BW": "Business Warehouse",
123
- "BWAP": "Below Weighted Average Price",
124
- "BY": "Burley",
125
- "C&PCR": "Complexity & Product Cost Reduction",
126
- "CAB": "Change Advisory Board",
127
- "CAB1, CAB2 and CAB3": "Types of changes in Information systems and applications",
128
- "CAGR": "Compound Annual Growth Rate",
129
- "CAM": "Central America",
130
- "CAP": "Customer Account Profitability",
131
- "CAPEX": "Capital Expenditure",
132
- "CAR": "Caribbean",
133
- "CARICOM": "Caribbean Community Regional Integration",
134
- "CBA": "Cost Benefit Analysis",
135
- "CCC": "Common Communication Code",
136
- "CCT": "Cut Tobacco at brought in cost",
137
- "CDF": "Consumer Disposition Funnel",
138
- "CDM": "Career Development Meeting",
139
- "CEA": "Cost Element Accounting",
140
- "CES": "Competitive Edge Series",
141
- "CI": "Continual Improvement",
142
- "CIGMAR": "Cigarrette Market (Group Marketing Information System)",
143
- "CKB": "Competitor Knowledge Base",
144
- "CLD": "Cased Leaf Drier (Tobacco process)",
145
- "CM": "Country Manager",
146
- "CMB": "Centrally Managed Brands",
147
- "COC": "Cigarette overhead conveyor",
148
- "CofE": "Centre of Expertise",
149
- "COL": "Cost of Living",
150
- "COMIECO": "Council of Ministers for Economic Integration",
151
- "CoO": "Cost Of Ownership / Country Of Origin",
152
- "COP": "Conference of the Parties",
153
- "CoPlan": "Company Plan",
154
- "CORESTA": "Co-operation Centre for Scientific Research Relative to Tabacco",
155
- "CP": "Cigarette Paper",
156
- "CPC": "Common Planning Calendar",
157
- "CPI": "Consumer Price Index / Cuts per inch (30 cpi for lamina, 120-160 cpi for stem)",
158
- "CPM": "Cigarettes Per Minute",
159
- "CPMH": "Cigarettes Per Man Hour",
160
- "CPQE": "Cigarette Physical Quality Evaluation",
161
- "CPT": "Consumer Product Testing",
162
- "CPTO": "Consumer Price Turn Over",
163
- "CQMS": "Corporate Quality Management System",
164
- "CR": "Comp. Ratio",
165
- "CRM": "Customer Relationship Management",
166
- "CROSQ": "CARICOM Regional Organisation for Standards & Quality",
167
- "CRS": "Cut Rolled Stem",
168
- "CRT": "Cut Rag Tobacco",
169
- "CS": "Cut stem",
170
- "CSI": "Consumer Satisfaction Index / Corporate Social Investment",
171
- "CSR": "Corporate Social Responsibility",
172
- "CST": "Cluster Strategy Team",
173
- "CTA": "Contribution to Admin",
174
- "CTS": "Cut Tobacco Store",
175
- "D&D": "Design & Destroyed",
176
- "D&S": "Design & Specify",
177
- "DAC": "Daily Average Consumption / Dark air cured",
178
- "DB": "Defined Benefit / Display Ban",
179
- "DC": "Defined Contribution",
180
- "DCC": "Direct Cylinder Conditioning / Direct Cylinder Conditioning and Casing",
181
- "DES": "Distribution Edge Series",
182
- "DG5": "Deployment Group 5",
183
- "DIET": "Dry Ice Expanded Tobacco",
184
- "DM": "Data Management",
185
- "DNP": "Duty Not Paid",
186
- "DO": "Distribution Outlets",
187
- "DOM": "Demand Operations Manager",
188
- "DP": "Duty Paid",
189
- "DRBU": "Direct Reporting Business Unit",
190
- "DRF": "Dust Recovery Fans",
191
- "DRG": "Design Reference Group",
192
- "DRP": "Disaster Recovery Programme / Distribution Resource Planning",
193
- "DSA": "Daily Sales Average",
194
- "DSD": "Direct to Store Delivery",
195
- "DSS": "Direct Store Sales",
196
- "DTI": "Department of Trade and Industry",
197
- "DTI": "Duty Transit Insurance",
198
- "DTR": "Double Tax Relief",
199
- "DTV": "Digital Tax Verification",
200
- "DX": "Distribution Excellence",
201
- "E2E": "End to end",
202
- "EAI": "Enterprise Applications Integration",
203
- "EAM": "Effective Area Management",
204
- "EAS": "Enterprise Applications Strategy",
205
- "ECLT": "Foundation Eliminating Child Labour in Tobacco Growing Foundation",
206
- "EDI": "Electronic Data Interchange",
207
- "EDM": "Executive Directors' Meeting",
208
- "EEC": "European Employee Council",
209
- "EFM": "Export Finance Manager",
210
- "EH&S": "Environmental, Health & Safety",
211
- "EM": "End Market / Environment Management",
212
- "EMF2": "Effective Market Focus",
213
- "EMSP": "End Market Strategic Plan",
214
- "ENDS": "Electronic nicotine delivery systems",
215
- "ENNDS": "Electronic non-nicotine delivery systems",
216
- "EOS": "Exchange Of Sale",
217
- "EP": "Electrostatic Perforation",
218
- "EPIC": "Enhanced Productivity in the Cloud",
219
- "EPO": "Enterprise Programme Office",
220
- "EPR": "Effective Problem Resolution",
221
- "ERP": "Enterprise Resource Planning",
222
- "ET": "Expanded Tobacco",
223
- "ETS": "Environmental Tobacco Smoke",
224
- "EUCA": "European Union Co-operation Agreement",
225
- "EVP": "Employee Value Proposition",
226
- "Expat": "Expatriate",
227
- "FC": "Forecast",
228
- "FCS": "Financial Control System",
229
- "FCTC": "Framework Convention for Tobacco Control",
230
- "FCV": "Flue Cured Virginia",
231
- "FD": "Finance Director",
232
- "FEP": "Finance Excellence Programme",
233
- "FF": "Full Flavour",
234
- "FFP": "Factory Foot Print / Fit for Purpose",
235
- "FG": "Finished Goods",
236
- "FGS": "Finished Goods Sales",
237
- "FIFO": "First In First Out",
238
- "FMC": "Factory Made Cigarettes",
239
- "FMCG": "Fast Moving Consumer Goods",
240
- "FOQ": "Fixed Order Quantity",
241
- "Foresight": "Sales forecasting and supply chain system",
242
- "FOT's": "French Overseas Territories",
243
- "FP": "Filling Power",
244
- "FPI": "Finished Product Inspection",
245
- "FTA": "Filter Tipo Attacher / Free Trade Agreement",
246
- "FTE": "Full Time Equivalent",
247
- "FTZ": "Free Trade Zone",
248
- "FV": "Fill Value",
249
- "FY": "Full Year",
250
- "FYR": "Full Year Results",
251
- "GAAP": "Generally Accepted Accounting Principles",
252
- "GAM": "Group Accounting Manual",
253
- "GBP": "Great Britain Pounds",
254
- "GDB": "Global Drive Brands",
255
- "GDP": "Gross Domestic Product",
256
- "GH": "Globe House (The British American Tobacco headquarters)",
257
- "GHS": "Globally Harmonised System",
258
- "GHW": "Graphic Health Warning",
259
- "GIP": "Global Integration Programme",
260
- "GIPS": "Group Intellectual Property Service",
261
- "GIT": "Goods in Transit",
262
- "GIV": "Gross Domestic Product",
263
- "GLOSS": "Global Leaf Order Supply System",
264
- "GLP": "Global Leaf Pool / Global Leaf Processing",
265
- "GLT": "Green Leaf Threshing",
266
- "GM": "General Manager",
267
- "GMAPP": "Group Manual of Accounting Policies and Procedures",
268
- "GOM": "Global Operating Model",
269
- "GP": "Guiding Principles",
270
- "GPC": "Group Product Champion",
271
- "GPMO": "Global Programme Management Office",
272
- "GPS": "Global Process Standards / Global Product Specification",
273
- "GPtW": "Great Place to Work",
274
- "GQT": "Group Quality Team",
275
- "GR&D": "Group Research & Development",
276
- "GRE": "Global Retail Excellence",
277
- "GRP": "Gross Rating Points",
278
- "GSC": "Global Standards Council / Global Supply Chain",
279
- "GSCS": "Global Supply Chain Strategy",
280
- "GSCSC": "Global Supply Chain Service Centre",
281
- "GSD": "Group Service Delivery",
282
- "GSI": "General Standing Instructions",
283
- "GSM": "Global Specification Management / Grams per square metre",
284
- "GSMP": "Global Service Management Project",
285
- "GSP": "Global Specification Platform / Global Strategy Process",
286
- "GSS": "Global Specification Services",
287
- "GTO": "Gross Turnover",
288
- "GTR": "Global Travel and Retail",
289
- "GUI": "Graphical User Interface",
290
- "GWD": "Gross Weighted Distribution",
291
- "W10": "Windows 10",
292
- "WAP": "Weighted Average Price",
293
- "WAR": "Warehouse Receipt",
294
- "WBS": "Work Breakdown Structure",
295
- "WCO": "World Customs Organization",
296
- "WEL": "Workplace Exposure Limit",
297
- "WER": "Western Europe",
298
- "WHA": "World Health Assembly",
299
- "WHO": "World Health Organisation",
300
- "WIC": "World Investment Co Ltd",
301
- "WITCO": "West Indian Tobacco Company",
302
- "WLB": "Work Life Balance",
303
- "WMS": "Warehouse Management System / Wrapping Materials Specifications / Wrapping Materials Stock",
304
- "WNTD": "World No Tobacco Day",
305
- "WTL": "Water Treated Lamina",
306
- "WTO": "World Trade Organization",
307
- "WTS": "Water Treated Stem",
308
- "WWTP": "Wastewater Treatment Plant",
309
- "YIU": "Yield in Use",
310
- "YoY": "Year on Year",
311
- "YSP": "Youth Smoking Prevention",
312
- "YTD": "Year To Date",
313
- "YTG": "Year To Go",
314
- "YV": "Your Voice Survey",
315
- "TOR": "Terms of Reference",
316
- "TP": "Trading Profit / Tobacco Product Directive",
317
- "TPM": "Total Particulate Matter",
318
- "TPP": "Trans Pacific Partnership",
319
- "TQM": "Total Quality Management",
320
- "TRM": "Talent Review Meetings",
321
- "TSG": "Tobacco Strategy Group (BAT Industries)",
322
- "TSP": "Total System Profit",
323
- "TT": "Top Team",
324
- "TTL": "Through-the-line (communication)",
325
- "TUSS": "Tobacco Utilisation Sourcing & Supply",
326
- "UAT": "User Acceptance Testing",
327
- "UGM": "User Group Meeting",
328
- "UKIB": "UK International brand",
329
- "ULow": "Ultra Low",
330
- "ULP": "Ultra Low Price",
331
- "UNSPS": "Universal Standards Products Service Classification",
332
- "UOM": "Unit Of Measure",
333
- "UOP": "Underlying Operating Profit",
334
- "USIB": "US International Brand",
335
- "VA": "Virginia",
336
- "VAT": "Value Added Tax (or sales tax)",
337
- "VFM": "Value For Money",
338
- "VMI": "Vendor Managed Inventory",
339
- "Vs": "Versus",
340
- "T&A": "Technical & Advisory Fee",
341
- "T&T": "Track and Trace",
342
- "TaO": "Target Operating Model and OneSAP / TaO Business Intelligence / TaO Business Objects / TaO Business Planning and Consolidation / TaO Central Process Scheduling / TaO ERP Central Component / TaO Enterprise Infrastructure Backbone / TaO Enterprise Search / TaO System Landscape Directory",
343
- "TCC": "Tobacco Control Community",
344
- "TCO": "Total Cost Ownership",
345
- "TIH": "Tactical Inventory Hub",
346
- "TLA": "Three Letter Acronym",
347
- "TLDW": "Team Leaders Development Workshop",
348
- "TM": "Time Management (SAP)",
349
- "TM&D": "Trade Marketing & Distribution / Trade Marketing and Distribution",
350
- "TMA": "Tobacco Manufacturer's Association",
351
- "TMC": "Tailor Made Cigarettes / Trade Marketing Communication",
352
- "TMD": "Trade Marketing Diversification",
353
- "TMU": "Trade Marketing Universe",
354
- "TMVF": "Trade Mark Verification",
355
- "TOM": "Target Operating Model",
356
- "TOP": "Type Of Part",
357
- "SH": "Section Head",
358
- "SICA": "Central American Integration System",
359
- "SIDS": "Screening Information Data Sets",
360
- "SIECA": "Secretariat for Economic Integration for Central America",
361
- "SIEF": "Substance Information Exchange Forum",
362
- "SIG": "Strategic Innovations Group",
363
- "SIMS": "Substance Inventory Management System",
364
- "SIS": "Shipments Information System",
365
- "SITA": "Worldwide telecommunications link",
366
- "SITPRO": "Simplification of Internal Trade Procedures",
367
- "SKU": "Stock Keeping Unit",
368
- "SL": "Storage Location / Super Long",
369
- "SLA": "Service Level Agreement / Strategic Leadership Agenda",
370
- "SM@RT": "Standardised Materials At Realistic Transfer Prices",
371
- "SMC": "Stakeholder Mapping & Classification",
372
- "SMD": "Secondary Manufacturing Department",
373
- "SMP": "Shared Materials Planning / Strategic Marketing Programme",
374
- "SOB": "Share of brand / Source of Business / Standards of Business Contact",
375
- "SOC": "Share of category",
376
- "SoD": "Segregation of Duties",
377
- "SODA": "Service Operation Desk Application",
378
- "SoDA": "Statement of Delegated Authorities",
379
- "SoM": "Share of Market",
380
- "SOPE": "Sales and Operations Planning Executive",
381
- "SOS": "Share of Sales",
382
- "SOV": "Share of Voice",
383
- "SP": "Supply Planning",
384
- "SPC": "Statistical Process Control",
385
- "SPD&S": "Strategic Product Development & Support",
386
- "SPI": "Strategy Planning Insights",
387
- "SPLY": "Same Period Last Year",
388
- "SPM": "Sales Promotional Merchandise",
389
- "SPOC": "Single Point Of Contact",
390
- "SPU": "Secondary Packing Unit",
391
- "SQ": "Superior Quality",
392
- "SQP": "Supplier Quality Partnership",
393
- "SREM": "Senior Regional Export Manager",
394
- "SRF": "Suppliers Request Forms",
395
- "SRG": "Scientific Research Group",
396
- "SRM": "Specified Risk Material / Supplier Relationship Management",
397
- "SRO": "Senior Responsible Owner",
398
- "SRTP": "Social Responsibility in Tobacco Production",
399
- "RCCP": "Rough Cut Capacity Plan",
400
- "RCD": "Rebates Commission and Discounts",
401
- "RCP": "Retail Classification Platform",
402
- "RD": "Regional Director",
403
- "RDF": "Retail Disposition Funnel",
404
- "REC": "Research Executive Council",
405
- "RFC": "Request For Change",
406
- "RLT": "Regional Leadership Team",
407
- "RM": "Records Management",
408
- "RML": "Retail Media Landscape",
409
- "RMM": "Risk Management Measure",
410
- "ROCE": "Return on Capital Employed",
411
- "RONA": "Return on Net Assets",
412
- "ROSE": "Return on Shareholders' Equity",
413
- "ROY": "Return of Investment",
414
- "RPC": "Regional Product Centre",
415
- "RPN": "Risk Priority Number",
416
- "RQI": "Retail Quality Index",
417
- "RRP": "Recommended Retail Price / Reduced Risk Product",
418
- "RTM": "Route to Market",
419
- "RYO": "Roll Your Own Tobacco",
420
- "S&OP": "Sales & Operations Planning",
421
- "S90": "A cigarette reservoir between the maker and the packer",
422
- "SAM": "Strategic Account Management / Strategic Assessment Management",
423
- "SAP GRC": "SAP Governance, Risk and Compliance",
424
- "SAP II": "SAP Information Interchange",
425
- "SAP PI": "SAP Process Integration / Interfaces between SAP ECC and other applications",
426
- "SAP": "Systems Administration Platform / Systems Application Programme / Systems, Applications & Prod",
427
- "SBS": "Strategic Business System",
428
- "SC": "Soft Cup / Supply Chain Champions",
429
- "SCA": "Supply Chain Academy",
430
- "SCAM": "Supply Chain Above Market",
431
- "SCC": "Supply Chain Collaborator",
432
- "SCCSE": "Supply Chain Customer Service Excellence",
433
- "SCDT": "Supply Chain Drive Team",
434
- "SCEE": "Supply Chain Eastern Europe",
435
- "SCEM": "Supply Chain Event Management",
436
- "SCM": "Solution Centre Managers / Supply Chain Management",
437
- "SCOC": "Suppliers Code of Conduct",
438
- "SCOR": "Supply Chain Operations Reference Model",
439
- "SCS": "Supply Chain Strategy / Supply Chain Synchronisation",
440
- "SCSC": "Supply Chain Service Centre",
441
- "SCWE": "Supply Chain Western Europe",
442
- "SD": "Sales Distribution",
443
- "SDG": "Strategic Design Group",
444
- "SDM": "Service Delivery Manager",
445
- "SDS": "Safety Data Sheet",
446
- "SEM": "Strategic Enterprise Management",
447
- "SGM": "Steering Group Meeting",
448
- "P&E": "Pricing & Excise",
449
- "P&L": "Profit and Loss",
450
- "P1": "Incident Priority 1",
451
- "P2": "Incident Priority 2",
452
- "P2P": "Procure to Pay",
453
- "P3": "Incident Priority 3",
454
- "P4": "Incident Priority 4",
455
- "PA": "Personal Administration (SAP)",
456
- "PACE": "Performance Appraisal and Career Evaluation",
457
- "PAG": "Programa de Alta Gerencia",
458
- "BRD": "Business Requirent Document",
459
- "BRS": "Business Requirent Document",
460
- "BATB":"British American Tobacco Bangladesh",
461
- "TAB": "Technology Architecture Board",
462
- "PAT": "Profit After Tax",
463
- "PBIT": "Profit before interest and tax",
464
- "PBS": "Product Breakdown Structure",
465
- "PBT": "Profit Before Tax",
466
- "PCF": "People Capability Framework",
467
- "PCR": "Product Complexity Reduction",
468
- "PCS": "Pack Collector Study",
469
- "PD": "Pressure Drop",
470
- "PDC": "Product Development Committee",
471
- "PDPC": "Primary Delivered Product Cost",
472
- "PDSG": "Product Development Strategy Group",
473
- "PDT": "Product Development Team",
474
- "PI&T": "Product Integrity & Traceability",
475
- "PID": "Project Initiation Document",
476
- "PIR": "Post Implementation Review",
477
- "PIT": "Point In Time",
478
- "PLC": "Programmable logic Controller",
479
- "PLM": "Product Life Management",
480
- "PLP": "Product Line Profitability",
481
- "PM": "Prime Minister",
482
- "PMC": "Proceso de Mejoramiento Contínuo",
483
- "PMD": "Primary Manufacturing Department",
484
- "PMI": "Phillip Morris International",
485
- "PMO": "Programme Management Office",
486
- "PMP": "People Management Programme",
487
- "PMS": "Planned Maintenance System",
488
- "PO": "Performance Objectives / Purchase Order",
489
- "POD": "Proof of Delivery",
490
- "POP": "Point of Purchase",
491
- "POS": "Point of Sale",
492
- "PP": "Plain Packaging / Production Plan",
493
- "PP&D": "Production Planning and Development",
494
- "PPA": "Psychophysical Analysis",
495
- "PPB": "Productivity Portfolio Board",
496
- "PPR": "Post Project Review",
497
- "PPS": "Public Place Smoking",
498
- "PQI": "Product Quality Index",
499
- "PQRS": "Physical Quality Rating System",
500
- "Pre-SOP": "Pre Sales & Operations Planning",
501
- "PRINCE": "Projects IN Controlled Environment",
502
- "PRP": "Profit Related Pay",
503
- "PSA": "Partial Scope Agreement / Product Space Appropriation",
504
- "PSC": "Primary Supply Chain",
505
- "PSG": "Product Steering Group",
506
- "PSM": "Product Space Mapping",
507
- "PSR": "Packed Store Room",
508
- "PSU": "Production Services Unit",
509
- "Pts": "Percentage points",
510
- "PTSG": "Process Technology Steering Group",
511
- "QA": "Quality Assurance",
512
- "QBR": "Quarterly Business Review",
513
- "QI": "Quality Inspection",
514
- "QMR": "Quarterly Marketing Report",
515
- "QPR": "Quarterly Performance Review / Quarterly Profit Review",
516
- "QS": "Qualitative Studies",
517
- "QTP": "Quality Through People",
518
- "QUAIL": "Quality In Leaf",
519
- "Quantum": "TM&D information system",
520
- "MRP": "Materials Requirements Planning / Materials Resource Planning",
521
- "MSD": "Management Services Department",
522
- "MSDS": "Materials Safety Data Sheet",
523
- "MSP": "Managing Successful Programmes / Market Share Points",
524
- "MT": "Management Trainee / Materials Testing",
525
- "MTO": "Make To Order",
526
- "MTS": "Make To Stock",
527
- "MXS": "Marketing Excellence Series",
528
- "MYO": "Make Your Own",
529
- "MYR": "Mid-Year Results / Mid-Year Review",
530
- "NAMAS": "National Measurement Accreditation Service",
531
- "NBD": "New Business Development",
532
- "NCD": "Non Communicable Diseases",
533
- "NFDPM": "Nicotine Free Dry Particulate Matter",
534
- "NGO": "Non-Governmental Organisation",
535
- "NGP": "New Generation Products",
536
- "NMG": "New Marketing Guidelines",
537
- "NND": "Net Net Density",
538
- "NP": "Net Permeability",
539
- "NPD": "New Product Development",
540
- "NPI": "New Product Innovation / New Product Introduction",
541
- "NQ": "Normal Quality",
542
- "NTO": "Net Turnover",
543
- "O2C": "Order To Cash",
544
- "O365": "Office 365",
545
- "OA": "Opportunity Analysis",
546
- "OBS": "Opportunistic Business Simulation",
547
- "OCA": "Out of Home (Advertising)",
548
- "OD": "Organisational Development",
549
- "OD(M)S": "One Day (Material) Store",
550
- "ODG": "Operational Design Group",
551
- "ODP": "Operational Demand Planning",
552
- "OE": "Order Estimate",
553
- "OEE": "Overall Equipment Effectiveness",
554
- "OEM": "Original Equipment Manufacturer",
555
- "OIE": "Other Income & Expense",
556
- "OLT": "Operations Leadership Team",
557
- "OM": "Operating Model / Organisational Management (Modulo SAP)",
558
- "OOH": "Out Of Home",
559
- "OOS": "Out Of Stock",
560
- "OP": "Operating Profit",
561
- "OPB": "Operations Portfolio Board",
562
- "OpCo": "Operating Company",
563
- "OpEx": "Operating Expenditure",
564
- "Ops": "Operations",
565
- "OR": "Oriental",
566
- "OSP": "Operational Supply Planning",
567
- "OTIF": "On Time In Full",
568
- "OTP": "Other Tobacco Products",
569
- "OTS": "Opportunity to See",
570
- "L&B": "Lambert & Butler",
571
- "L&D": "Liggett & Myers / Learning & Development",
572
- "LAN": "Local Area Network",
573
- "LAT": "Local Area Team",
574
- "LC": "Leadership Capabilities",
575
- "LCP": "Local Cycle Plan",
576
- "LDP": "Local Demand Plan",
577
- "LE": "Latest Estimate / Limited Edition",
578
- "LEO": "Legal Entity Object",
579
- "LEP": "Limited Edition Pack",
580
- "LEX": "Legal and External Affairs",
581
- "LIFO": "Last In First Out",
582
- "LIMS": "Laboratory Information Management Solution",
583
- "LIP": "Lower Ignition Propensity",
584
- "LLT": "Local Leadership Team",
585
- "LN": "Lotus Notes",
586
- "LOC": "Letter Of Credit",
587
- "LOF": "Language of Finance",
588
- "LOS": "Line Of Sight",
589
- "LOV": "List Of Values",
590
- "LPE": "Latest Profit Estimate",
591
- "LPO": "Local Purchase Order",
592
- "LPV": "Low Production Volume",
593
- "LRR": "Leaf Reception Room",
594
- "M&S": "Materials and Supplies",
595
- "MASQ": "Method for Assessing Smoking Quality",
596
- "MAT": "Moving Annual Total",
597
- "MCE": "Minimum Collectible Excise",
598
- "MD": "Managing Director",
599
- "MEC": "Manufacturing Executive Council",
600
- "MFU": "Marketing Finance Unit",
601
- "MGP": "Materials Guidance Panel",
602
- "MI": "Management Information",
603
- "Mille": "One thousand cigarettes",
604
- "MKT": "Marketing",
605
- "MLT": "Marketing Leadership Team",
606
- "MMA": "Management Marketing Account",
607
- "MN": "Million",
608
- "MNF": "Manufacturing",
609
- "MoC": "Minister of Commerce",
610
- "MoF": "Minister of Finance",
611
- "MoH": "Minister of Health",
612
- "Mon": "Month on Month",
613
- "MOP": "Members of the Protocol",
614
- "MOPE": "Monthly Operating Profit Estimate",
615
- "MoS": "Measure of Success",
616
- "MPQ": "Managing Product Quality",
617
- "MPS": "Master Production Scheduling",
618
- "MPSG": "Master and Product Strategy Group",
619
- "MQI": "Manufacturing Quality Index",
620
- "MQS": "Materials Qualification System",
621
- "MR": "Management Review",
622
- "MRP II": "Manufacturing Resource Planning",
623
- "IT": "Illicit Trade / Information Technology",
624
- "ITC": "India Tobacco Company",
625
- "ITGA": "International Tobacco Growers’ Association",
626
- "ITIL": "Information Technology Infrastructure Library",
627
- "ITP": "Illicit Trade Protocol",
628
- "ITPC": "IT Project Committee",
629
- "ITT": "Internationally Traded Tobacco",
630
- "JIT": "Just In Time",
631
- "JRC": "Joint Research Centre",
632
- "JTI": "Japan Tobacco International",
633
- "JV": "Joint venture",
634
- "KCN": "Key Control Navigator",
635
- "KDFII": "Filter rod maker, supplied by Hauni",
636
- "KPI": "Key Performance Indicator",
637
- "KRA": "Key Result Areas",
638
- "KS": "King Size",
639
- "KSF": "King Size Filter",
640
- "KSI": "Key Strategic Initiatives",
641
- "KYC": "Know your Customer",
642
- "KYS": "Know Your Supplier",
643
- "H2": "Half 2",
644
- "HB": "Haus Bergman",
645
- "HL": "Hinge Lid",
646
- "HLP": "Hinge Lid Packer",
647
- "HoD": "Head of Department",
648
- "HoF": "Head of Function",
649
- "HOLO": "Head of Leaf Operations",
650
- "HOLP": "Head of Leaf Processing",
651
- "Horeca": "Hotels, Restaurants and Cafes",
652
- "HoS": "Head office Services",
653
- "HP": "High Potential",
654
- "HPV": "High Production Volume",
655
- "HQ": "High Quality",
656
- "HR": "Human Resources",
657
- "HRBP": "Human Resources Business Partner",
658
- "HS Code": "Harmonized Commodity Description and Coding System",
659
- "HSE": "Health, Safety, Environment",
660
- "HSU": "High Speed Unit",
661
- "HTD": "High Temperature Dryer",
662
- "HVST": "High Velocity Stem Tube",
663
- "I&C": "Information & Consultation",
664
- "IA": "International Assignment",
665
- "IAAA": "International Advertising Association",
666
- "IAM": "Identity and Access Management",
667
- "IB": "International brand",
668
- "IBG": "International Brand Group",
669
- "ICA": "Inward Cartage Allowance",
670
- "ICC": "International Chamber of Commerce",
671
- "ICP": "International Career Plan",
672
- "IDP": "Individual Development Programme",
673
- "IE11": "Internet Explorer 11",
674
- "IEIS": "International Executive Incentive Scheme",
675
- "IFRS": "International Financial Reporting Standards",
676
- "IMASCO": "Financial Services, Tobacco and Retailing Group (Canada)",
677
- "IMF": "International Monetary Fund",
678
- "IMI": "Incoming Materials Inspection",
679
- "IMP": "International Marketing Principles",
680
- "IMS": "International Marketing Standards",
681
- "INTERPOL": "International Criminal Police Organization",
682
- "IP": "Intellectual Property",
683
- "IPP": "Integrated Planning Process",
684
- "IPR": "Intellectual Property Rights",
685
- "IPRA": "International Political and Regulatory Affairs",
686
- "IR": "Investor Relations",
687
- "ISC": "Integrated Supply Chain",
688
- "ISF": "In Store Furniture",
689
- "PED" : "Primary Engineering Department",
690
- "EOB" : "End of Business Day",
691
- "OOO" :"Out of Office",
692
-
693
  }
694
 
695
- app = Flask(__name__)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
696
 
697
- @app.route('/')
698
- def index():
699
- return render_template_string(open('index.html').read())
 
 
 
 
 
 
700
 
701
- @app.route('/get_abbreviation', methods=['POST'])
702
- def get_abbreviation():
703
- acronym = request.form['acronym'].strip().upper()
704
- response = knowledge_base.get(acronym, "Not found in the BATCCAPEDIA")
705
- return jsonify({"response": response})
 
 
706
 
707
- if __name__ == '__main__':
708
- app.run()
 
709
 
710
- def gradio_ui(acronym):
711
- response = knowledge_base.get(acronym.strip().upper(), "Not found in the BATCCAPEDIA")
712
- return response
 
713
 
714
- iface = gr.Interface(
715
- fn=gradio_ui,
716
- inputs="text",
717
- outputs="text",
718
- title="BATB Acronym Finder",
719
- description="Dictionary of Abbreviations & Acronyms",
720
- theme='default',
721
- live=True
722
- )
723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
 
725
- iface.launch(app=app, inline=True)
 
 
1
  import gradio as gr
 
2
 
3
  # Define the knowledge base as a dictionary
4
  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
+ def get_abbreviation(acronym):
19
+ acronym = acronym.strip().upper()
20
+ response = knowledge_base.get(acronym, "Not found in the BATCCAPEDIA")
21
+ return response
22
+
23
+ with gr.Blocks() as demo:
24
+ gr.HTML('''
25
+ <!DOCTYPE html>
26
+ <html lang="en">
27
+ <head>
28
+ <meta charset="UTF-8">
29
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
30
+ <title>BATB Acronym Finder</title>
31
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
32
+ <style>
33
+ /* Add your previous CSS code here */
34
+ body, html {
35
+ margin: 0;
36
+ height: 100%;
37
+ width: 100%;
38
+ font-family: 'Microsoft JhengHei', Arial, sans-serif;
39
+ background: #bdc3c7;
40
+ background: linear-gradient(to right bottom, #bdc3c7 , #2c3e50);
41
+ }
42
+ .chat {
43
+ position: absolute;
44
+ top: 50%;
45
+ left: 50%;
46
+ transform: translate(-50%, -50%);
47
+ width: 300px;
48
+ height: 80vh;
49
+ max-height: 500px;
50
+ border-radius: 15px;
51
+ background-color: rgba(0, 0, 0, .5);
52
+ overflow: hidden;
53
+ }
54
+ .chat-title {
55
+ background-color: rgba(0, 0, 0, .3);
56
+ width: 100%;
57
+ height: 50px;
58
+ display: flex;
59
+ align-items: center;
60
+ padding: 0 10px;
61
+ box-sizing: border-box;
62
+ }
63
+ .chat-title h2 {
64
+ margin: 0;
65
+ color: #f0f0f0;
66
+ font-size: 16px;
67
+ flex-grow: 1;
68
+ }
69
+ .chat-title .avatar {
70
+ width: 30px;
71
+ height: 30px;
72
+ border-radius: 50%;
73
+ overflow: hidden;
74
+ margin-right: 10px;
75
+ }
76
+ .chat-title .avatar img {
77
+ width: 100%;
78
+ height: 100%;
79
+ border-radius: 50%;
80
+ }
81
+ .messages {
82
+ width: 100%;
83
+ height: calc(100% - 90px);
84
+ overflow-y: auto;
85
+ padding: 10px;
86
+ box-sizing: border-box;
87
+ }
88
+ .messages .message {
89
+ max-width: calc(100% - 76px);
90
+ padding: 8px;
91
+ margin: 8px 0;
92
+ border-radius: 5px;
93
+ background-color: rgba(255, 255, 255, .1);
94
+ color: #e3e3e3;
95
+ font-size: 13px;
96
+ position: relative;
97
+ word-break: break-all;
98
+ }
99
+ .messages .message.personal {
100
+ background-color: rgba(76, 175, 80, .1);
101
+ margin-left: auto;
102
+ }
103
+ .messages .timestamp {
104
+ position: absolute;
105
+ right: -50px;
106
+ bottom: 0;
107
+ font-size: 12px;
108
+ color: #bababa;
109
+ }
110
+ .action-box {
111
+ background-color: rgba(0, 0, 0, .3);
112
+ width: 100%;
113
+ height: 40px;
114
+ display: flex;
115
+ align-items: center;
116
+ box-sizing: border-box;
117
+ }
118
+ .action-box-input {
119
+ flex-grow: 1;
120
+ background-color: transparent;
121
+ border: 0;
122
+ padding: 0 10px;
123
+ color: white;
124
+ font-size: 16px;
125
+ height: 100%;
126
+ }
127
+ .action-box-input:focus {
128
+ outline: none;
129
+ }
130
+ .action-box-submit {
131
+ width: 60px;
132
+ height: 100%;
133
+ background-color: rgba(189, 195, 199, .2);
134
+ color: white;
135
+ border: 0;
136
+ cursor: pointer;
137
+ display: flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ }
141
+ .action-box-submit i {
142
+ font-size: 16px;
143
+ }
144
+ </style>
145
+ </head>
146
+ <body>
147
+ <div class="chat">
148
+ <div class="chat-title">
149
+ <div class="avatar">
150
+ <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/764024/profile/profile-512.jpg" alt="Avatar">
151
+ </div>
152
+ <h2>Kelly Chen</h2>
153
+ </div>
154
+ <div class="messages">
155
+ <div class="messages-content"></div>
156
+ </div>
157
+ <div class="action-box">
158
+ <textarea class="action-box-input" type="text" placeholder="Type message..."></textarea>
159
+ <button class="action-box-submit" type="submit">
160
+ <i class="fa fa-paper-plane"></i>
161
+ </button>
162
+ </div>
163
+ </div>
164
+ <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
165
+ <script>
166
+ var messages = $(".messages-content");
167
 
168
+ function insertMessage() {
169
+ var msgText = $(".action-box-input").val();
170
+ if ($.trim(msgText) == "") {
171
+ return false;
172
+ }
173
+ var msg = $("<div>").addClass("message personal").text(msgText);
174
+ $("<div>").addClass("timestamp").text(getTimestamp()).appendTo(msg);
175
+ msg.appendTo($('.messages-content'));
176
+ $(".action-box-input").val(null);
177
 
178
+ gradioApp().get_abbreviation(msgText).then(function(response) {
179
+ var responseMsg = $("<div>").addClass("message").text(response);
180
+ $("<div>").addClass("timestamp").text(getTimestamp()).appendTo(responseMsg);
181
+ responseMsg.appendTo($('.messages-content'));
182
+ updateScrollbar();
183
+ });
184
+ }
185
 
186
+ function updateScrollbar() {
187
+ messages.scrollTop(messages[0].scrollHeight);
188
+ }
189
 
190
+ function getTimestamp() {
191
+ var d = new Date();
192
+ return d.getHours() + ":" + (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
193
+ }
194
 
195
+ $(window).on('keydown', function (e) {
196
+ if (e.which == 13) {
197
+ insertMessage();
198
+ return false;
199
+ }
200
+ });
 
 
 
201
 
202
+ $(document).ready(function() {
203
+ messages.scrollTop(messages[0].scrollHeight);
204
+ });
205
+ </script>
206
+ </body>
207
+ </html>
208
+ ''')
209
+
210
+ chatbot_interface = gr.Interface(
211
+ fn=get_abbreviation,
212
+ inputs="text",
213
+ outputs="text",
214
+ live=True
215
+ )
216
+ chatbot_interface.launch()
217
 
218
+ if __name__ == "__main__":
219
+ demo.launch()