Spaces:
Runtime error
Runtime error
vector store works on local
Browse files- .gitignore +3 -0
- Documents/HR Policy Manual.docx +0 -0
- Documents/HR Policy Manual.pdf +0 -0
- Documents/IT Department Policy Manual.docx +0 -0
- Documents/IT Department Policy Manual.pdf +0 -0
- Documents/Tranportation Policy Manual.docx +0 -0
- Documents/Tranportation Policy Manual.pdf +0 -0
- Makefile.venv +272 -0
- Tickets.csv +177 -0
- app.py +67 -0
- makefile +14 -0
- pages/Create_ML_Model.py +110 -0
- pages/Load_Data_Store.py +36 -0
- pages/Pending_tickets.py +26 -0
- pages/admin_utils.py +88 -0
- requirements.txt +13 -0
- user_utils.py +43 -0
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
.venv
|
2 |
+
.env
|
3 |
+
__pycache__
|
Documents/HR Policy Manual.docx
ADDED
Binary file (16.7 kB). View file
|
|
Documents/HR Policy Manual.pdf
ADDED
Binary file (114 kB). View file
|
|
Documents/IT Department Policy Manual.docx
ADDED
Binary file (17.7 kB). View file
|
|
Documents/IT Department Policy Manual.pdf
ADDED
Binary file (122 kB). View file
|
|
Documents/Tranportation Policy Manual.docx
ADDED
Binary file (16.5 kB). View file
|
|
Documents/Tranportation Policy Manual.pdf
ADDED
Binary file (108 kB). View file
|
|
Makefile.venv
ADDED
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#
|
2 |
+
# SEAMLESSLY MANAGE PYTHON VIRTUAL ENVIRONMENT WITH A MAKEFILE
|
3 |
+
#
|
4 |
+
# https://github.com/sio/Makefile.venv v2023.04.17
|
5 |
+
#
|
6 |
+
#
|
7 |
+
# Insert `include Makefile.venv` at the bottom of your Makefile to enable these
|
8 |
+
# rules.
|
9 |
+
#
|
10 |
+
# When writing your Makefile use '$(VENV)/python' to refer to the Python
|
11 |
+
# interpreter within virtual environment and '$(VENV)/executablename' for any
|
12 |
+
# other executable in venv.
|
13 |
+
#
|
14 |
+
# This Makefile provides the following targets:
|
15 |
+
# venv
|
16 |
+
# Use this as a dependency for any target that requires virtual
|
17 |
+
# environment to be created and configured
|
18 |
+
# python, ipython
|
19 |
+
# Use these to launch interactive Python shell within virtual environment
|
20 |
+
# shell, bash, zsh
|
21 |
+
# Launch interactive command line shell. "shell" target launches the
|
22 |
+
# default shell Makefile executes its rules in (usually /bin/sh).
|
23 |
+
# "bash" and "zsh" can be used to refer to the specific desired shell.
|
24 |
+
# show-venv
|
25 |
+
# Show versions of Python and pip, and the path to the virtual environment
|
26 |
+
# clean-venv
|
27 |
+
# Remove virtual environment
|
28 |
+
# $(VENV)/executable_name
|
29 |
+
# Install `executable_name` with pip. Only packages with names matching
|
30 |
+
# the name of the corresponding executable are supported.
|
31 |
+
# Use this as a lightweight mechanism for development dependencies
|
32 |
+
# tracking. E.g. for one-off tools that are not required in every
|
33 |
+
# developer's environment, therefore are not included into
|
34 |
+
# requirements.txt or setup.py.
|
35 |
+
# Note:
|
36 |
+
# Rules using such target or dependency MUST be defined below
|
37 |
+
# `include` directive to make use of correct $(VENV) value.
|
38 |
+
# Example:
|
39 |
+
# codestyle: $(VENV)/pyflakes
|
40 |
+
# $(VENV)/pyflakes .
|
41 |
+
# See `ipython` target below for another example.
|
42 |
+
#
|
43 |
+
# This Makefile can be configured via following variables:
|
44 |
+
# PY
|
45 |
+
# Command name for system Python interpreter. It is used only initially to
|
46 |
+
# create the virtual environment
|
47 |
+
# Default: python3
|
48 |
+
# REQUIREMENTS_TXT
|
49 |
+
# Space separated list of paths to requirements.txt files.
|
50 |
+
# Paths are resolved relative to current working directory.
|
51 |
+
# Default: requirements.txt
|
52 |
+
#
|
53 |
+
# Non-existent files are treated as hard dependencies,
|
54 |
+
# recipes for creating such files must be provided by the main Makefile.
|
55 |
+
# Providing empty value (REQUIREMENTS_TXT=) turns off processing of
|
56 |
+
# requirements.txt even when the file exists.
|
57 |
+
# SETUP_PY, SETUP_CFG, PYPROJECT_TOML, VENV_LOCAL_PACKAGE
|
58 |
+
# Space separated list of paths to files that contain build instructions
|
59 |
+
# for local Python packages. Corresponding packages will be installed
|
60 |
+
# into venv in editable mode along with all their dependencies.
|
61 |
+
# Default: setup.py setup.cfg pyproject.toml (whichever present)
|
62 |
+
#
|
63 |
+
# Non-existent and empty values are treated in the same way as for REQUIREMENTS_TXT.
|
64 |
+
# WORKDIR
|
65 |
+
# Parent directory for the virtual environment.
|
66 |
+
# Default: current working directory.
|
67 |
+
# VENVDIR
|
68 |
+
# Python virtual environment directory.
|
69 |
+
# Default: $(WORKDIR)/.venv
|
70 |
+
#
|
71 |
+
# This Makefile was written for GNU Make and may not work with other make
|
72 |
+
# implementations.
|
73 |
+
#
|
74 |
+
#
|
75 |
+
# Copyright (c) 2019-2023 Vitaly Potyarkin
|
76 |
+
#
|
77 |
+
# Licensed under the Apache License, Version 2.0
|
78 |
+
# <http://www.apache.org/licenses/LICENSE-2.0>
|
79 |
+
#
|
80 |
+
|
81 |
+
|
82 |
+
#
|
83 |
+
# Configuration variables
|
84 |
+
#
|
85 |
+
|
86 |
+
WORKDIR?=.
|
87 |
+
VENVDIR?=$(WORKDIR)/.venv
|
88 |
+
REQUIREMENTS_TXT?=$(wildcard requirements.txt) # Multiple paths are supported (space separated)
|
89 |
+
SETUP_PY?=$(wildcard setup.py) # Multiple paths are supported (space separated)
|
90 |
+
SETUP_CFG?=$(foreach s,$(SETUP_PY),$(wildcard $(patsubst %setup.py,%setup.cfg,$(s))))
|
91 |
+
PYPROJECT_TOML?=$(wildcard pyproject.toml)
|
92 |
+
VENV_LOCAL_PACKAGE?=$(SETUP_PY) $(SETUP_CFG) $(PYPROJECT_TOML)
|
93 |
+
MARKER=.initialized-with-Makefile.venv
|
94 |
+
|
95 |
+
|
96 |
+
#
|
97 |
+
# Python interpreter detection
|
98 |
+
#
|
99 |
+
|
100 |
+
_PY_AUTODETECT_MSG=Detected Python interpreter: $(PY). Use PY environment variable to override
|
101 |
+
|
102 |
+
ifeq (ok,$(shell test -e /dev/null 2>&1 && echo ok))
|
103 |
+
NULL_STDERR=2>/dev/null
|
104 |
+
else
|
105 |
+
NULL_STDERR=2>NUL
|
106 |
+
endif
|
107 |
+
|
108 |
+
ifndef PY
|
109 |
+
_PY_OPTION:=python3
|
110 |
+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
|
111 |
+
PY=$(_PY_OPTION)
|
112 |
+
endif
|
113 |
+
endif
|
114 |
+
|
115 |
+
ifndef PY
|
116 |
+
_PY_OPTION:=$(VENVDIR)/bin/python
|
117 |
+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
|
118 |
+
PY=$(_PY_OPTION)
|
119 |
+
$(info $(_PY_AUTODETECT_MSG))
|
120 |
+
endif
|
121 |
+
endif
|
122 |
+
|
123 |
+
ifndef PY
|
124 |
+
_PY_OPTION:=$(subst /,\,$(VENVDIR)/Scripts/python)
|
125 |
+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
|
126 |
+
PY=$(_PY_OPTION)
|
127 |
+
$(info $(_PY_AUTODETECT_MSG))
|
128 |
+
endif
|
129 |
+
endif
|
130 |
+
|
131 |
+
ifndef PY
|
132 |
+
_PY_OPTION:=py -3
|
133 |
+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
|
134 |
+
PY=$(_PY_OPTION)
|
135 |
+
$(info $(_PY_AUTODETECT_MSG))
|
136 |
+
endif
|
137 |
+
endif
|
138 |
+
|
139 |
+
ifndef PY
|
140 |
+
_PY_OPTION:=python
|
141 |
+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
|
142 |
+
PY=$(_PY_OPTION)
|
143 |
+
$(info $(_PY_AUTODETECT_MSG))
|
144 |
+
endif
|
145 |
+
endif
|
146 |
+
|
147 |
+
ifndef PY
|
148 |
+
define _PY_AUTODETECT_ERR
|
149 |
+
Could not detect Python interpreter automatically.
|
150 |
+
Please specify path to interpreter via PY environment variable.
|
151 |
+
endef
|
152 |
+
$(error $(_PY_AUTODETECT_ERR))
|
153 |
+
endif
|
154 |
+
|
155 |
+
|
156 |
+
#
|
157 |
+
# Internal variable resolution
|
158 |
+
#
|
159 |
+
|
160 |
+
VENV=$(VENVDIR)/bin
|
161 |
+
EXE=
|
162 |
+
# Detect windows
|
163 |
+
ifeq (win32,$(shell $(PY) -c "import __future__, sys; print(sys.platform)"))
|
164 |
+
VENV=$(VENVDIR)/Scripts
|
165 |
+
EXE=.exe
|
166 |
+
endif
|
167 |
+
|
168 |
+
touch=touch $(1)
|
169 |
+
ifeq (,$(shell command -v touch $(NULL_STDERR)))
|
170 |
+
# https://ss64.com/nt/touch.html
|
171 |
+
touch=type nul >> $(subst /,\,$(1)) && copy /y /b $(subst /,\,$(1))+,, $(subst /,\,$(1))
|
172 |
+
endif
|
173 |
+
|
174 |
+
RM?=rm -f
|
175 |
+
ifeq (,$(shell command -v $(firstword $(RM)) $(NULL_STDERR)))
|
176 |
+
RMDIR:=rd /s /q
|
177 |
+
else
|
178 |
+
RMDIR:=$(RM) -r
|
179 |
+
endif
|
180 |
+
|
181 |
+
|
182 |
+
#
|
183 |
+
# Virtual environment
|
184 |
+
#
|
185 |
+
|
186 |
+
.PHONY: venv
|
187 |
+
venv: $(VENV)/$(MARKER)
|
188 |
+
|
189 |
+
.PHONY: clean-venv
|
190 |
+
clean-venv:
|
191 |
+
-$(RMDIR) "$(VENVDIR)"
|
192 |
+
|
193 |
+
.PHONY: show-venv
|
194 |
+
show-venv: venv
|
195 |
+
@$(VENV)/python -c "import sys; print('Python ' + sys.version.replace('\n',''))"
|
196 |
+
@$(VENV)/pip --version
|
197 |
+
@echo venv: $(VENVDIR)
|
198 |
+
|
199 |
+
.PHONY: debug-venv
|
200 |
+
debug-venv:
|
201 |
+
@echo "PATH (Shell)=$$PATH"
|
202 |
+
@$(MAKE) --version
|
203 |
+
$(info PATH (GNU Make)="$(PATH)")
|
204 |
+
$(info SHELL="$(SHELL)")
|
205 |
+
$(info PY="$(PY)")
|
206 |
+
$(info REQUIREMENTS_TXT="$(REQUIREMENTS_TXT)")
|
207 |
+
$(info VENV_LOCAL_PACKAGE="$(VENV_LOCAL_PACKAGE)")
|
208 |
+
$(info VENVDIR="$(VENVDIR)")
|
209 |
+
$(info VENVDEPENDS="$(VENVDEPENDS)")
|
210 |
+
$(info WORKDIR="$(WORKDIR)")
|
211 |
+
|
212 |
+
|
213 |
+
#
|
214 |
+
# Dependencies
|
215 |
+
#
|
216 |
+
|
217 |
+
ifneq ($(strip $(REQUIREMENTS_TXT)),)
|
218 |
+
VENVDEPENDS+=$(REQUIREMENTS_TXT)
|
219 |
+
endif
|
220 |
+
|
221 |
+
ifneq ($(strip $(VENV_LOCAL_PACKAGE)),)
|
222 |
+
VENVDEPENDS+=$(VENV_LOCAL_PACKAGE)
|
223 |
+
endif
|
224 |
+
|
225 |
+
$(VENV):
|
226 |
+
$(PY) -m venv $(VENVDIR)
|
227 |
+
$(VENV)/python -m pip install --upgrade pip setuptools wheel
|
228 |
+
|
229 |
+
$(VENV)/$(MARKER): $(VENVDEPENDS) | $(VENV)
|
230 |
+
ifneq ($(strip $(REQUIREMENTS_TXT)),)
|
231 |
+
$(VENV)/pip install $(foreach path,$(REQUIREMENTS_TXT),-r $(path))
|
232 |
+
endif
|
233 |
+
ifneq ($(strip $(VENV_LOCAL_PACKAGE)),)
|
234 |
+
$(VENV)/pip install $(foreach path,$(sort $(VENV_LOCAL_PACKAGE)),-e $(dir $(path)))
|
235 |
+
endif
|
236 |
+
$(call touch,$(VENV)/$(MARKER))
|
237 |
+
|
238 |
+
|
239 |
+
#
|
240 |
+
# Interactive shells
|
241 |
+
#
|
242 |
+
|
243 |
+
.PHONY: python
|
244 |
+
python: venv
|
245 |
+
exec $(VENV)/python
|
246 |
+
|
247 |
+
.PHONY: ipython
|
248 |
+
ipython: $(VENV)/ipython
|
249 |
+
exec $(VENV)/ipython
|
250 |
+
|
251 |
+
.PHONY: shell
|
252 |
+
shell: venv
|
253 |
+
. $(VENV)/activate && exec $(notdir $(SHELL))
|
254 |
+
|
255 |
+
.PHONY: bash zsh
|
256 |
+
bash zsh: venv
|
257 |
+
. $(VENV)/activate && exec $@
|
258 |
+
|
259 |
+
|
260 |
+
#
|
261 |
+
# Commandline tools (wildcard rule, executable name must match package name)
|
262 |
+
#
|
263 |
+
|
264 |
+
ifneq ($(EXE),)
|
265 |
+
$(VENV)/%: $(VENV)/%$(EXE) ;
|
266 |
+
.PHONY: $(VENV)/%
|
267 |
+
.PRECIOUS: $(VENV)/%$(EXE)
|
268 |
+
endif
|
269 |
+
|
270 |
+
$(VENV)/%$(EXE): $(VENV)/$(MARKER)
|
271 |
+
$(VENV)/pip install --upgrade $*
|
272 |
+
$(call touch,$@)
|
Tickets.csv
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"The bus arrived late again, causing me to miss an important meeting.",Transportation
|
2 |
+
"The taxi driver took a longer route, resulting in an inflated fare.",Transportation
|
3 |
+
"There's no proper signage at the train station, making it confusing for passengers.",Transportation
|
4 |
+
The flight was delayed for hours without any proper explanation.,Transportation
|
5 |
+
The bus driver was rude and unprofessional during the entire journey.,Transportation
|
6 |
+
"The train compartments were overcrowded, and there were no seats available.",Transportation
|
7 |
+
"I booked a cab, but it never arrived at the designated pick-up location.",Transportation
|
8 |
+
"The airline lost my luggage, and I haven't received any updates on its whereabouts.",Transportation
|
9 |
+
"The taxi had a broken seatbelt, posing a safety risk during the ride.",Transportation
|
10 |
+
"The bus broke down in the middle of the journey, causing a significant delay.",Transportation
|
11 |
+
"The train schedule is inconsistent, with frequent cancellations and delays.",Transportation
|
12 |
+
The airline customer service was unresponsive and provided no assistance.,Transportation
|
13 |
+
"The taxi smelled strongly of smoke, making the ride uncomfortable and unpleasant.",Transportation
|
14 |
+
There's a lack of wheelchair accessibility on public transportation vehicles.,Transportation
|
15 |
+
The flight attendant was rude and disrespectful towards passengers.,Transportation
|
16 |
+
"The bus station lacks proper facilities, including restrooms and waiting areas.",Transportation
|
17 |
+
"The taxi driver was speeding and driving recklessly, compromising passenger safety.",Transportation
|
18 |
+
The train ticketing system charged me twice for the same journey.,Transportation
|
19 |
+
"The airline overbooked the flight, causing me to be denied boarding.",Transportation
|
20 |
+
"The taxi driver refused to take me to my destination, citing a short trip.",Transportation
|
21 |
+
The bus seats were uncomfortable and in poor condition.,Transportation
|
22 |
+
"The train announcements were unclear, making it difficult to understand the next stop.",Transportation
|
23 |
+
"I purchased an online ticket, but the QR code was not recognized by the ticket scanner.",Transportation
|
24 |
+
"The airline misplaced my pet during the flight, causing distress and anxiety.",Transportation
|
25 |
+
"The taxi meter was tampered with, resulting in an inflated fare.",Transportation
|
26 |
+
"The bus driver skipped my designated stop, forcing me to walk a long distance.",Transportation
|
27 |
+
"The train platform was overcrowded, and there were no proper crowd management measures.",Transportation
|
28 |
+
The airline canceled my flight without any prior notification or alternative arrangements.,Transportation
|
29 |
+
"The taxi driver took a longer route to increase the fare, even though I provided directions.",Transportation
|
30 |
+
"The bus was dirty and poorly maintained, with broken seats and windows.",Transportation
|
31 |
+
"The train was extremely overcrowded, with passengers struggling to find space.",Transportation
|
32 |
+
I had difficulty finding a parking space at the airport due to insufficient availability.,Transportation
|
33 |
+
The taxi driver was playing loud music and refused to lower the volume upon request.,Transportation
|
34 |
+
"The bus driver was not following the designated route, causing confusion among passengers.",Transportation
|
35 |
+
"The train ticket vending machine was out of order, causing inconvenience to passengers.",Transportation
|
36 |
+
I experienced motion sickness due to poor driving skills of the taxi driver.,Transportation
|
37 |
+
The airline changed my flight schedule without notifying me in advance.,Transportation
|
38 |
+
"The bus was not wheelchair accessible, making it challenging for passengers with disabilities.",Transportation
|
39 |
+
"The train doors were malfunctioning, posing a safety hazard during boarding and disembarking.",Transportation
|
40 |
+
"The taxi driver was using a mobile phone while driving, endangering passengers' safety.",Transportation
|
41 |
+
"The bus driver was constantly honking unnecessarily, causing disturbance and discomfort.",Transportation
|
42 |
+
"The train was overcrowded, and there were no functioning air conditioning units.",Transportation
|
43 |
+
I received no assistance with my heavy luggage from the airline staff.,Transportation
|
44 |
+
"The taxi driver dropped me off at the wrong location, despite providing the correct address.",Transportation
|
45 |
+
"The bus schedule was inaccurate, with buses arriving either too early or too late.",Transportation
|
46 |
+
"The train station lacks proper lighting, posing safety concerns during evening hours.",Transportation
|
47 |
+
"I was wrongly charged for excess baggage on the airline, even though I was within the allowed limit.",Transportation
|
48 |
+
The taxi driver was driving aggressively and abruptly changing lanes without warning.,Transportation
|
49 |
+
The software crashes frequently during data entry. It's affecting my productivity.,IT
|
50 |
+
I haven't received my salary for the past two months. Can someone from HR please look into this?,HR
|
51 |
+
"The network is slow, and I'm unable to access important files. Could the IT team check it?",IT
|
52 |
+
I'm facing issues with my medical insurance coverage. Can HR assist me in resolving this matter?,HR
|
53 |
+
"The printer in our department is constantly jamming, causing delays in our work. IT, please fix it urgently.",IT
|
54 |
+
"I've been experiencing harassment from a colleague. HR, I need your help to address this problem.",HR
|
55 |
+
"The system keeps logging me out repeatedly. IT, please investigate and resolve this issue.",IT
|
56 |
+
"I have a concern regarding my vacation leave balance. HR, can you provide clarification?",HR
|
57 |
+
"There's a problem with the email server. I can't send or receive emails. IT, please resolve it quickly.",IT
|
58 |
+
"I believe there's an error in my tax deductions. HR, could you please review my payroll details?",HR
|
59 |
+
"The new software update is causing compatibility issues with my computer. IT, can you assist in fixing it?",IT
|
60 |
+
"HR, I haven't received any response to my promotion request. Can you please update me on the status?",HR
|
61 |
+
"The internet connection in our office is unreliable. IT, please look into this matter as soon as possible.",IT
|
62 |
+
"I need assistance with setting up my company email on my mobile device. IT, can you guide me through it?",IT
|
63 |
+
"I'm facing difficulties accessing my employee benefits portal. HR, can you help me resolve this issue?",HR
|
64 |
+
"IT, I accidentally deleted an important file. Is there any way to recover it?",IT
|
65 |
+
"I have concerns about the working hours. HR, can we discuss possible adjustments?",HR
|
66 |
+
"The video conferencing software is not functioning properly. IT, please fix it before our meeting.",IT
|
67 |
+
"I have questions about the company's policy on parental leave. HR, can you provide me with the details?",HR
|
68 |
+
"IT, the projector in the meeting room is not working. We need it for the presentation.",IT
|
69 |
+
"I'm having trouble accessing my employee account. HR, can you assist me in resetting my password?",HR
|
70 |
+
"The software is giving me error messages whenever I try to save my work. IT, please resolve this issue.",IT
|
71 |
+
"HR, there's an error in my employment contract. Can you review it and make the necessary corrections?",HR
|
72 |
+
"IT, I need a software license key to install a program on my computer. Can you provide it?",IT
|
73 |
+
"I'm experiencing issues with my company-issued laptop. HR, can you arrange for a replacement?",HR
|
74 |
+
"The server is down, and we are unable to access our files. IT, please fix it immediately.",IT
|
75 |
+
"I have concerns about the work environment. HR, can we schedule a meeting to discuss it?",HR
|
76 |
+
"IT, the wireless network is not available in certain areas of the office. Can you investigate the issue?",IT
|
77 |
+
"I need help with updating my personal information in the HR system. HR, can you guide me through the process?",HR
|
78 |
+
"The software is not compatible with my operating system. IT, can you recommend a solution?",IT
|
79 |
+
"The HR department did not process my vacation request on time, causing inconvenience.",HR
|
80 |
+
"IT, the email attachments are not opening correctly. Please resolve this issue promptly.",IT
|
81 |
+
"There's a discrepancy in my performance evaluation. HR, can we schedule a meeting to discuss it?",HR
|
82 |
+
I'm unable to access the HR portal to update my personal information. Can someone assist me with this?,HR
|
83 |
+
The IT helpdesk has not responded to my support ticket for three days. Please prioritize it.,IT
|
84 |
+
"I have concerns about the onboarding process. HR, can we improve the orientation program?",HR
|
85 |
+
"IT, the software license on my computer has expired. Can you renew it?",IT
|
86 |
+
"I'm facing difficulties with the time tracking system. HR, can you provide guidance on how to use it?",HR
|
87 |
+
"The Wi-Fi network in our office is not secure. IT, please ensure that appropriate measures are taken.",IT
|
88 |
+
I'm experiencing issues with the HR benefits enrollment process. Can someone assist me with this?,HR
|
89 |
+
"IT, I need assistance in setting up a virtual private network (VPN) for secure remote access.",IT
|
90 |
+
"There's a conflict within our team. HR, can you mediate and help resolve the issue?",HR
|
91 |
+
"I'm receiving spam emails repeatedly. IT, please enhance the email filtering system.",IT
|
92 |
+
The HR department has not provided me with the required training materials. Can this be addressed?,HR
|
93 |
+
"IT, I accidentally deleted an important file from the shared drive. Can you recover it?",IT
|
94 |
+
"I have concerns about the employee recognition program. HR, can we implement improvements?",HR
|
95 |
+
"The IT system crashed during an important presentation, causing embarrassment. Please fix this issue.",IT
|
96 |
+
I'm experiencing difficulties with the HR self-service portal. Can someone provide technical support?,HR
|
97 |
+
"IT, the video conferencing software is not compatible with my device. Please suggest an alternative.",IT
|
98 |
+
"There's an error in my salary calculation. HR, can you review it and rectify the mistake?",HR
|
99 |
+
"I'm unable to print documents from my computer. IT, can you investigate and resolve the issue?",IT
|
100 |
+
The HR department needs to streamline the employee appraisal process. Can improvements be made?,HR
|
101 |
+
"IT, my computer is running slow, affecting my productivity. Can you optimize its performance?",IT
|
102 |
+
"I have concerns about the diversity and inclusion initiatives. HR, can we discuss this further?",HR
|
103 |
+
The IT team needs to provide more comprehensive cybersecurity training to employees.,IT
|
104 |
+
I'm experiencing delays in receiving responses from the HR department. Can this be addressed?,HR
|
105 |
+
"IT, the website is not loading properly. Please investigate and fix the issue.",IT
|
106 |
+
"There's a lack of communication regarding policy updates. HR, can we improve internal notifications?",HR
|
107 |
+
"I need assistance with data recovery from a damaged hard drive. IT, can you help me retrieve the files?",IT
|
108 |
+
The HR department needs to address the employee morale issue. Can we conduct a survey?,HR
|
109 |
+
The IT department has not resolved my software installation issue despite multiple requests.,IT
|
110 |
+
"HR, there is a discrepancy in my employee benefits coverage. Can you please investigate and rectify it?",HR
|
111 |
+
"I'm experiencing network connectivity problems in the conference room. IT, can you check and fix it?",IT
|
112 |
+
"There's a conflict between me and my supervisor. HR, I need assistance in resolving this matter.",HR
|
113 |
+
"IT, the server is experiencing frequent outages, disrupting our work. Please address the issue urgently.",IT
|
114 |
+
"I have concerns about the transparency of the promotion process. HR, can we discuss this and provide clarity?",HR
|
115 |
+
"IT, my computer is infected with a virus. Please perform a thorough scan and remove any malware.",IT
|
116 |
+
"I'm having difficulties accessing my training materials on the learning management system. HR, can you help?",HR
|
117 |
+
The IT helpdesk provided incorrect instructions for resolving my technical issue. Can someone correct it?,IT
|
118 |
+
"I believe my performance review was biased and unfair. HR, can you conduct a thorough investigation?",HR
|
119 |
+
"IT, I need assistance in recovering a deleted email from my inbox. Is it possible to retrieve it?",IT
|
120 |
+
"There's a lack of communication regarding company policies. HR, can we improve the dissemination process?",HR
|
121 |
+
"I'm experiencing frequent system crashes while using a specific software. IT, can you investigate and fix it?",IT
|
122 |
+
The HR department has not responded to my leave application. Can you please expedite the approval process?,HR
|
123 |
+
"IT, I accidentally formatted my external hard drive. Is there any way to recover the lost data?",IT
|
124 |
+
"I have concerns about the effectiveness of our performance appraisal system. HR, can we explore improvements?",HR
|
125 |
+
"The IT network in our office is not secure, leaving us vulnerable to cyber threats. Please address the issue.",IT
|
126 |
+
I'm facing difficulties accessing the HR policy manual. Can you provide an updated version or alternative access?,HR
|
127 |
+
"IT, the software update has caused compatibility issues with other applications. Can you find a solution?",IT
|
128 |
+
"There's an error in my timesheet records. HR, can you rectify it to ensure accurate payroll processing?",HR
|
129 |
+
"I'm unable to connect to the VPN for remote access. IT, can you troubleshoot and help me establish a connection?",IT
|
130 |
+
The HR department needs to enhance communication channels for employee feedback. Can improvements be made?,HR
|
131 |
+
"IT, the conference room audio system is malfunctioning, affecting our meetings. Please fix it as soon as possible.",IT
|
132 |
+
"I have concerns about the accuracy of my expense reimbursements. HR, can we review and reconcile the records?",HR
|
133 |
+
The IT team needs to improve response time for resolving technical issues. Urgent matters are being delayed.,IT
|
134 |
+
"I'm experiencing delays in receiving my performance bonus. HR, can you check the status and provide an update?",HR
|
135 |
+
"IT, the software license on my computer is about to expire. Can you renew it before it causes any disruptions?",IT
|
136 |
+
"There's a lack of diversity in the company's hiring process. HR, can we implement more inclusive practices?",HR
|
137 |
+
"I need assistance with data backup and recovery procedures. IT, can you provide guidance on best practices?",IT
|
138 |
+
The HR department needs to address concerns related to work-life balance. Can we implement flexible policies?,HR
|
139 |
+
"IT, the software application is crashing whenever I try to export data. Can you investigate and fix the issue?",IT
|
140 |
+
"I have concerns about the transparency of the salary structure. HR, can we discuss and provide more clarity?",HR
|
141 |
+
"The network printer in our department is constantly offline. IT, please resolve this issue as it hampers productivity.",IT
|
142 |
+
I'm facing difficulties accessing my performance metrics on the HR portal. Can you provide assistance?,HR
|
143 |
+
"IT, there's a persistent issue with the video conferencing system. It frequently disconnects during meetings.",IT
|
144 |
+
"I've been subjected to workplace bullying by a colleague. HR, I need your immediate intervention to address this.",HR
|
145 |
+
"The software license on my computer has expired. IT, can you provide a renewed license key?",IT
|
146 |
+
I'm experiencing challenges with the HR onboarding process. Can you streamline and improve it?,HR
|
147 |
+
"IT, my computer is infected with malware. Can you perform a thorough scan and remove the malicious files?",IT
|
148 |
+
"I have concerns about the accuracy of my attendance records. HR, can we review and rectify any discrepancies?",HR
|
149 |
+
The IT helpdesk is not responsive to my technical support requests. It's causing delays in my work.,IT
|
150 |
+
"HR, I need clarification regarding the company's bereavement leave policy. Can you provide detailed information?",HR
|
151 |
+
"The software is not compatible with my operating system. IT, can you recommend an alternative solution?",IT
|
152 |
+
"I'm facing difficulties accessing my employee benefits portal. HR, can you provide guidance on resolving this?",HR
|
153 |
+
"IT, there's a problem with the server configuration, leading to intermittent downtime. Please address it urgently.",IT
|
154 |
+
"I believe there's an error in my performance appraisal rating. HR, can you review and amend it accordingly?",HR
|
155 |
+
"The IT network in our office is not reliable. It frequently disconnects, disrupting our work.",IT
|
156 |
+
"I'm unable to access the HR policy manual. HR, can you provide an updated copy or alternative access?",HR
|
157 |
+
"IT, my laptop is overheating, which is affecting its performance. Can you provide a solution to prevent this?",IT
|
158 |
+
The HR department needs to improve communication regarding employee development opportunities.,HR
|
159 |
+
I'm experiencing delays in receiving responses to my HR inquiries. Can this be addressed promptly?,HR
|
160 |
+
"IT, the software update has caused a loss of data on my computer. Is there any way to recover the lost files?",IT
|
161 |
+
"There's a lack of clarity in the company's remote work policy. HR, can we discuss and provide clear guidelines?",HR
|
162 |
+
"I'm unable to access my email account. IT, can you assist in resolving this issue?",IT
|
163 |
+
The HR department needs to address concerns related to employee recognition and rewards programs.,HR
|
164 |
+
"IT, the server response time is significantly slow, affecting our productivity. Please optimize its performance.",IT
|
165 |
+
"I have concerns about the fairness of the promotion process. HR, can we ensure equal opportunities for all employees?",HR
|
166 |
+
"The software interface is not user-friendly. IT, can you provide training or alternative software options?",IT
|
167 |
+
I'm experiencing challenges with the HR grievance handling process. Can you provide guidance and support?,HR
|
168 |
+
"IT, there's an issue with the backup system. It's not capturing the latest data. Please investigate and fix it.",IT
|
169 |
+
The HR department needs to improve communication regarding policy updates and changes.,HR
|
170 |
+
I'm facing difficulties with the IT asset management system. Can you provide assistance in tracking and managing assets?,IT
|
171 |
+
"IT, the website is not loading properly in certain browsers. Can you investigate and resolve the compatibility issue?",IT
|
172 |
+
"There's a lack of diversity in the company's leadership positions. HR, can we implement strategies for promoting diversity?",HR
|
173 |
+
"I'm experiencing difficulties with the remote access VPN. IT, can you troubleshoot and help me establish a secure connection?",IT
|
174 |
+
The HR department needs to address concerns related to employee morale and job satisfaction.,HR
|
175 |
+
"IT, the software is not saving my preferences and settings. Can you investigate and fix the issue?",IT
|
176 |
+
"I have concerns about the accuracy of my expense reimbursements. HR, can we review and rectify any discrepancies?",HR
|
177 |
+
The IT network in our office is not secure. Can you implement additional security measures to protect sensitive data?,IT
|
app.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dotenv import load_dotenv
|
2 |
+
import streamlit as st
|
3 |
+
from user_utils import *
|
4 |
+
|
5 |
+
#Creating session variables
|
6 |
+
if 'HR_tickets' not in st.session_state:
|
7 |
+
st.session_state['HR_tickets'] =[]
|
8 |
+
if 'IT_tickets' not in st.session_state:
|
9 |
+
st.session_state['IT_tickets'] =[]
|
10 |
+
if 'Transport_tickets' not in st.session_state:
|
11 |
+
st.session_state['Transport_tickets'] =[]
|
12 |
+
|
13 |
+
load_dotenv()
|
14 |
+
|
15 |
+
def main():
|
16 |
+
|
17 |
+
|
18 |
+
st.header("Automatic Ticket Classification Tool")
|
19 |
+
#Capture user input
|
20 |
+
st.write("We are here to help you, please ask your question:")
|
21 |
+
user_input = st.text_input("🔍")
|
22 |
+
|
23 |
+
if user_input:
|
24 |
+
|
25 |
+
#creating embeddings instance
|
26 |
+
embeddings=create_embeddings()
|
27 |
+
|
28 |
+
#Function to pull index data from Pinecone
|
29 |
+
index=pull_from_pinecone(embeddings)
|
30 |
+
|
31 |
+
#This function will help us in fetching the top relevent documents from our vector store - Pinecone Index
|
32 |
+
relavant_docs=get_similar_docs(index,user_input)
|
33 |
+
|
34 |
+
#This will return the fine tuned response by LLM
|
35 |
+
response=get_answer(relavant_docs,user_input)
|
36 |
+
st.write(response)
|
37 |
+
|
38 |
+
|
39 |
+
#Button to create a ticket with respective department
|
40 |
+
button = st.button("Submit ticket?")
|
41 |
+
|
42 |
+
if button:
|
43 |
+
#Get Response
|
44 |
+
|
45 |
+
|
46 |
+
embeddings = create_embeddings()
|
47 |
+
query_result = embeddings.embed_query(user_input)
|
48 |
+
|
49 |
+
#loading the ML model, so that we can use it to predit the class to which this compliant belongs to...
|
50 |
+
department_value = predict(query_result)
|
51 |
+
st.write("your ticket has been sumbitted to : "+department_value)
|
52 |
+
|
53 |
+
#Appending the tickets to below list, so that we can view/use them later on...
|
54 |
+
if department_value=="HR":
|
55 |
+
st.session_state['HR_tickets'].append(user_input)
|
56 |
+
elif department_value=="IT":
|
57 |
+
st.session_state['IT_tickets'].append(user_input)
|
58 |
+
else:
|
59 |
+
st.session_state['Transport_tickets'].append(user_input)
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
if __name__ == '__main__':
|
64 |
+
main()
|
65 |
+
|
66 |
+
|
67 |
+
|
makefile
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
PYTHON_BINARY = $(VENV)/python
|
4 |
+
STREAMLIT_BINARY = $(VENV)/streamlit
|
5 |
+
|
6 |
+
|
7 |
+
re-venv: clean-venv venv
|
8 |
+
|
9 |
+
run: venv
|
10 |
+
$(PYTHON_BINARY) app.py
|
11 |
+
$(STREAMLIT_BINARY) run app.py
|
12 |
+
|
13 |
+
|
14 |
+
include Makefile.venv
|
pages/Create_ML_Model.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from pages.admin_utils import *
|
3 |
+
from sklearn.svm import SVC
|
4 |
+
from sklearn.pipeline import make_pipeline
|
5 |
+
from sklearn.preprocessing import StandardScaler
|
6 |
+
import joblib
|
7 |
+
|
8 |
+
from pages.admin_utils import *
|
9 |
+
|
10 |
+
|
11 |
+
if 'cleaned_data' not in st.session_state:
|
12 |
+
st.session_state['cleaned_data'] =''
|
13 |
+
if 'sentences_train' not in st.session_state:
|
14 |
+
st.session_state['sentences_train'] =''
|
15 |
+
if 'sentences_test' not in st.session_state:
|
16 |
+
st.session_state['sentences_test'] =''
|
17 |
+
if 'labels_train' not in st.session_state:
|
18 |
+
st.session_state['labels_train'] =''
|
19 |
+
if 'labels_test' not in st.session_state:
|
20 |
+
st.session_state['labels_test'] =''
|
21 |
+
if 'svm_classifier' not in st.session_state:
|
22 |
+
st.session_state['svm_classifier'] =''
|
23 |
+
|
24 |
+
|
25 |
+
st.title("Let's build our Model...")
|
26 |
+
|
27 |
+
# Create tabs
|
28 |
+
tab_titles = ['Data Preprocessing', 'Model Training', 'Model Evaluation',"Save Model"]
|
29 |
+
tabs = st.tabs(tab_titles)
|
30 |
+
|
31 |
+
# Adding content to each tab
|
32 |
+
|
33 |
+
#Data Preprocessing TAB
|
34 |
+
with tabs[0]:
|
35 |
+
st.header('Data Preprocessing')
|
36 |
+
st.write('Here we preprocess the data...')
|
37 |
+
|
38 |
+
# Capture the CSV file
|
39 |
+
data = st.file_uploader("Upload CSV file",type="csv")
|
40 |
+
|
41 |
+
button = st.button("Load data",key="data")
|
42 |
+
|
43 |
+
if button:
|
44 |
+
with st.spinner('Wait for it...'):
|
45 |
+
our_data=read_data(data)
|
46 |
+
embeddings=get_embeddings()
|
47 |
+
st.session_state['cleaned_data'] = create_embeddings(our_data,embeddings)
|
48 |
+
st.success('Done!')
|
49 |
+
|
50 |
+
|
51 |
+
#Model Training TAB
|
52 |
+
with tabs[1]:
|
53 |
+
st.header('Model Training')
|
54 |
+
st.write('Here we train the model...')
|
55 |
+
button = st.button("Train model",key="model")
|
56 |
+
|
57 |
+
if button:
|
58 |
+
with st.spinner('Wait for it...'):
|
59 |
+
st.session_state['sentences_train'], st.session_state['sentences_test'], st.session_state['labels_train'], st.session_state['labels_test']=split_train_test__data(st.session_state['cleaned_data'])
|
60 |
+
|
61 |
+
# Initialize a support vector machine, with class_weight='balanced' because
|
62 |
+
# our training set has roughly an equal amount of positive and negative
|
63 |
+
# sentiment sentences
|
64 |
+
st.session_state['svm_classifier'] = make_pipeline(StandardScaler(), SVC(class_weight='balanced'))
|
65 |
+
|
66 |
+
# fit the support vector machine
|
67 |
+
st.session_state['svm_classifier'].fit(st.session_state['sentences_train'], st.session_state['labels_train'])
|
68 |
+
st.success('Done!')
|
69 |
+
|
70 |
+
#Model Evaluation TAB
|
71 |
+
with tabs[2]:
|
72 |
+
st.header('Model Evaluation')
|
73 |
+
st.write('Here we evaluate the model...')
|
74 |
+
button = st.button("Evaluate model",key="Evaluation")
|
75 |
+
|
76 |
+
if button:
|
77 |
+
with st.spinner('Wait for it...'):
|
78 |
+
accuracy_score=get_score(st.session_state['svm_classifier'],st.session_state['sentences_test'],st.session_state['labels_test'])
|
79 |
+
st.success(f"Validation accuracy is {100*accuracy_score}%!")
|
80 |
+
|
81 |
+
|
82 |
+
st.write("A sample run:")
|
83 |
+
|
84 |
+
|
85 |
+
#text="lack of communication regarding policy updates salary, can we please look into it?"
|
86 |
+
text="Rude driver with scary driving"
|
87 |
+
st.write("***Our issue*** : "+text)
|
88 |
+
|
89 |
+
#Converting out TEXT to NUMERICAL representaion
|
90 |
+
embeddings= get_embeddings()
|
91 |
+
query_result = embeddings.embed_query(text)
|
92 |
+
|
93 |
+
#Sample prediction using our trained model
|
94 |
+
result= st.session_state['svm_classifier'].predict([query_result])
|
95 |
+
st.write("***Department it belongs to*** : "+result[0])
|
96 |
+
|
97 |
+
|
98 |
+
st.success('Done!')
|
99 |
+
|
100 |
+
#Save model TAB
|
101 |
+
with tabs[3]:
|
102 |
+
st.header('Save model')
|
103 |
+
st.write('Here we save the model...')
|
104 |
+
|
105 |
+
button = st.button("Save model",key="save")
|
106 |
+
if button:
|
107 |
+
|
108 |
+
with st.spinner('Wait for it...'):
|
109 |
+
joblib.dump(st.session_state['svm_classifier'], 'modelsvm.pk1')
|
110 |
+
st.success('Done!')
|
pages/Load_Data_Store.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from pages.admin_utils import *
|
4 |
+
|
5 |
+
|
6 |
+
def main():
|
7 |
+
load_dotenv()
|
8 |
+
st.set_page_config(page_title="Dump PDF to Pinecone - Vector Store")
|
9 |
+
st.title("Please upload your files...📁 ")
|
10 |
+
|
11 |
+
# Upload the pdf file
|
12 |
+
pdf = st.file_uploader("Only PDF files allowed", type=["pdf"])
|
13 |
+
|
14 |
+
# Extract the whole text from the uploaded pdf file
|
15 |
+
if pdf is not None:
|
16 |
+
with st.spinner('Wait for it...'):
|
17 |
+
text=read_pdf_data(pdf)
|
18 |
+
st.write("👉Reading PDF done")
|
19 |
+
|
20 |
+
# Create chunks
|
21 |
+
docs_chunks=split_data(text)
|
22 |
+
#st.write(docs_chunks)
|
23 |
+
st.write("👉Splitting data into chunks done")
|
24 |
+
|
25 |
+
# Create the embeddings
|
26 |
+
embeddings=create_embeddings_load_data()
|
27 |
+
st.write("👉Creating embeddings instance done")
|
28 |
+
|
29 |
+
# Build the vector store (Push the PDF data embeddings)
|
30 |
+
push_to_pinecone(embeddings,docs_chunks)
|
31 |
+
|
32 |
+
st.success("Successfully pushed the embeddings to Pinecone")
|
33 |
+
|
34 |
+
|
35 |
+
if __name__ == '__main__':
|
36 |
+
main()
|
pages/Pending_tickets.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
st.title('Departments')
|
4 |
+
|
5 |
+
# Create tabs
|
6 |
+
tab_titles = ['HR Support', 'IT Support', 'Transportation Support']
|
7 |
+
tabs = st.tabs(tab_titles)
|
8 |
+
|
9 |
+
# Add content to each tab
|
10 |
+
with tabs[0]:
|
11 |
+
st.header('HR Support tickets')
|
12 |
+
for ticket in st.session_state['HR_tickets']:
|
13 |
+
st.write(str(st.session_state['HR_tickets'].index(ticket)+1)+" : "+ticket)
|
14 |
+
|
15 |
+
|
16 |
+
with tabs[1]:
|
17 |
+
st.header('IT Support tickets')
|
18 |
+
for ticket in st.session_state['IT_tickets']:
|
19 |
+
st.write(str(st.session_state['IT_tickets'].index(ticket)+1)+" : "+ticket)
|
20 |
+
|
21 |
+
with tabs[2]:
|
22 |
+
st.header('Transportation Support tickets')
|
23 |
+
for ticket in st.session_state['Transport_tickets']:
|
24 |
+
st.write(str(st.session_state['Transport_tickets'].index(ticket)+1)+" : "+ticket)
|
25 |
+
|
26 |
+
|
pages/admin_utils.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import pandas as pd
|
4 |
+
import pinecone
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
from langchain.embeddings import OpenAIEmbeddings
|
7 |
+
from langchain.embeddings.sentence_transformer import \
|
8 |
+
SentenceTransformerEmbeddings
|
9 |
+
from langchain.llms import OpenAI
|
10 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
11 |
+
from langchain.vectorstores import Pinecone
|
12 |
+
from pypdf import PdfReader
|
13 |
+
from sklearn.model_selection import train_test_split
|
14 |
+
from functools import lru_cache
|
15 |
+
|
16 |
+
|
17 |
+
#**********Functions to help you load documents to PINECONE***********
|
18 |
+
|
19 |
+
#Read PDF data
|
20 |
+
def read_pdf_data(pdf_file):
|
21 |
+
pdf_page = PdfReader(pdf_file)
|
22 |
+
text = ""
|
23 |
+
for page in pdf_page.pages:
|
24 |
+
text += page.extract_text()
|
25 |
+
return text
|
26 |
+
|
27 |
+
#Split data into chunks
|
28 |
+
def split_data(text):
|
29 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=50)
|
30 |
+
docs = text_splitter.split_text(text)
|
31 |
+
docs_chunks =text_splitter.create_documents(docs)
|
32 |
+
return docs_chunks
|
33 |
+
|
34 |
+
#Create embeddings instance
|
35 |
+
def create_embeddings_load_data():
|
36 |
+
#embeddings = OpenAIEmbeddings()
|
37 |
+
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
38 |
+
return embeddings
|
39 |
+
|
40 |
+
|
41 |
+
@lru_cache
|
42 |
+
def pine_cone_index(pinecone_index_name: str | None):
|
43 |
+
load_dotenv()
|
44 |
+
pinecone.init(
|
45 |
+
api_key=os.getenv('PINECONE_API_KEY'),
|
46 |
+
environment=os.getenv('PINECONE_ENV'),
|
47 |
+
)
|
48 |
+
|
49 |
+
index_name = pinecone_index_name or os.getenv('PINECONE_INDEX_NAME')
|
50 |
+
if index_name is None:
|
51 |
+
raise ValueError('PINECONE_INDEX_NAME is not set')
|
52 |
+
return index_name
|
53 |
+
|
54 |
+
|
55 |
+
def push_to_pinecone(embeddings,docs,pinecone_index_name: str | None=None):
|
56 |
+
index_name = pine_cone_index(pinecone_index_name)
|
57 |
+
index = Pinecone.from_documents(docs, embeddings, index_name=index_name)
|
58 |
+
return index
|
59 |
+
|
60 |
+
#*********Functions for dealing with Model related tasks...************
|
61 |
+
|
62 |
+
#Read dataset for model creation
|
63 |
+
def read_data(data):
|
64 |
+
df = pd.read_csv(data,delimiter=',', header=None)
|
65 |
+
return df
|
66 |
+
|
67 |
+
#Create embeddings instance
|
68 |
+
def get_embeddings():
|
69 |
+
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
70 |
+
return embeddings
|
71 |
+
|
72 |
+
#Generating embeddings for our input dataset
|
73 |
+
def create_embeddings(df,embeddings):
|
74 |
+
df[2] = df[0].apply(lambda x: embeddings.embed_query(x))
|
75 |
+
return df
|
76 |
+
|
77 |
+
#Splitting the data into train & test
|
78 |
+
def split_train_test__data(df_sample):
|
79 |
+
# Split into training and testing sets
|
80 |
+
sentences_train, sentences_test, labels_train, labels_test = train_test_split(
|
81 |
+
list(df_sample[2]), list(df_sample[1]), test_size=0.25, random_state=0)
|
82 |
+
print(len(sentences_train))
|
83 |
+
return sentences_train, sentences_test, labels_train, labels_test
|
84 |
+
|
85 |
+
#Get the accuracy score on test data
|
86 |
+
def get_score(svm_classifier,sentences_test,labels_test):
|
87 |
+
score = svm_classifier.score(sentences_test, labels_test)
|
88 |
+
return score
|
requirements.txt
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
langchain
|
2 |
+
openai
|
3 |
+
Streamlit
|
4 |
+
huggingface_hub
|
5 |
+
python-dotenv
|
6 |
+
watchdog
|
7 |
+
tiktoken
|
8 |
+
pinecone-client
|
9 |
+
pypdf
|
10 |
+
joblib
|
11 |
+
pandas
|
12 |
+
scikit-learn
|
13 |
+
sentence_transformers
|
user_utils.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import joblib
|
4 |
+
from langchain.callbacks import get_openai_callback
|
5 |
+
from langchain.chains.question_answering import load_qa_chain
|
6 |
+
from langchain.embeddings.sentence_transformer import \
|
7 |
+
SentenceTransformerEmbeddings
|
8 |
+
from langchain.llms import OpenAI
|
9 |
+
from langchain.vectorstores import Pinecone
|
10 |
+
|
11 |
+
from pages.admin_utils import pine_cone_index
|
12 |
+
|
13 |
+
|
14 |
+
#Function to pull index data from Pinecone
|
15 |
+
def pull_from_pinecone(embeddings,pinecone_index_name: str | None=None):
|
16 |
+
index_name = pine_cone_index(pinecone_index_name)
|
17 |
+
|
18 |
+
index = Pinecone.from_existing_index(index_name, embeddings)
|
19 |
+
return index
|
20 |
+
|
21 |
+
def create_embeddings():
|
22 |
+
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
23 |
+
return embeddings
|
24 |
+
|
25 |
+
#This function will help us in fetching the top relevent documents from our vector store - Pinecone Index
|
26 |
+
def get_similar_docs(index,query,k=2):
|
27 |
+
|
28 |
+
similar_docs = index.similarity_search(query, k=k)
|
29 |
+
return similar_docs
|
30 |
+
|
31 |
+
def get_answer(docs,user_input):
|
32 |
+
chain = load_qa_chain(OpenAI(), chain_type="stuff")
|
33 |
+
with get_openai_callback() as cb:
|
34 |
+
response = chain.run(input_documents=docs, question=user_input)
|
35 |
+
return response
|
36 |
+
|
37 |
+
|
38 |
+
def predict(query_result):
|
39 |
+
if os.path.exists('modelsvm.pk1'):
|
40 |
+
Fitmodel = joblib.load('modelsvm.pk1')
|
41 |
+
result=Fitmodel.predict([query_result])
|
42 |
+
return result[0]
|
43 |
+
return "No Idea?"
|