Spaces:
Runtime error
Runtime error
Upload 9 files
Browse files- .gitignore +161 -0
- Home.py +68 -0
- Pipfile +24 -0
- Pipfile.lock +0 -0
- __init__.py +0 -0
- app.png +0 -0
- modelsvm.pk1 +0 -0
- requirements.txt +12 -0
- utils.py +117 -0
.gitignore
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
cacert.pem
|
| 3 |
+
__pycache__/
|
| 4 |
+
*.py[cod]
|
| 5 |
+
*$py.class
|
| 6 |
+
|
| 7 |
+
# C extensions
|
| 8 |
+
*.so
|
| 9 |
+
|
| 10 |
+
# Distribution / packaging
|
| 11 |
+
.Python
|
| 12 |
+
build/
|
| 13 |
+
develop-eggs/
|
| 14 |
+
dist/
|
| 15 |
+
downloads/
|
| 16 |
+
eggs/
|
| 17 |
+
.eggs/
|
| 18 |
+
lib/
|
| 19 |
+
lib64/
|
| 20 |
+
parts/
|
| 21 |
+
sdist/
|
| 22 |
+
var/
|
| 23 |
+
wheels/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# PyInstaller
|
| 31 |
+
# Usually these files are written by a python script from a template
|
| 32 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 33 |
+
*.manifest
|
| 34 |
+
*.spec
|
| 35 |
+
|
| 36 |
+
# Installer logs
|
| 37 |
+
pip-log.txt
|
| 38 |
+
pip-delete-this-directory.txt
|
| 39 |
+
|
| 40 |
+
# Unit test / coverage reports
|
| 41 |
+
htmlcov/
|
| 42 |
+
.tox/
|
| 43 |
+
.nox/
|
| 44 |
+
.coverage
|
| 45 |
+
.coverage.*
|
| 46 |
+
.cache
|
| 47 |
+
nosetests.xml
|
| 48 |
+
coverage.xml
|
| 49 |
+
*.cover
|
| 50 |
+
*.py,cover
|
| 51 |
+
.hypothesis/
|
| 52 |
+
.pytest_cache/
|
| 53 |
+
cover/
|
| 54 |
+
|
| 55 |
+
# Translations
|
| 56 |
+
*.mo
|
| 57 |
+
*.pot
|
| 58 |
+
|
| 59 |
+
# Django stuff:
|
| 60 |
+
*.log
|
| 61 |
+
local_settings.py
|
| 62 |
+
db.sqlite3
|
| 63 |
+
db.sqlite3-journal
|
| 64 |
+
|
| 65 |
+
# Flask stuff:
|
| 66 |
+
instance/
|
| 67 |
+
.webassets-cache
|
| 68 |
+
|
| 69 |
+
# Scrapy stuff:
|
| 70 |
+
.scrapy
|
| 71 |
+
|
| 72 |
+
# Sphinx documentation
|
| 73 |
+
docs/_build/
|
| 74 |
+
|
| 75 |
+
# PyBuilder
|
| 76 |
+
.pybuilder/
|
| 77 |
+
target/
|
| 78 |
+
|
| 79 |
+
# Jupyter Notebook
|
| 80 |
+
.ipynb_checkpoints
|
| 81 |
+
|
| 82 |
+
# IPython
|
| 83 |
+
profile_default/
|
| 84 |
+
ipython_config.py
|
| 85 |
+
|
| 86 |
+
# pyenv
|
| 87 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 88 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 89 |
+
# .python-version
|
| 90 |
+
|
| 91 |
+
# pipenv
|
| 92 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 93 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 94 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 95 |
+
# install all needed dependencies.
|
| 96 |
+
#Pipfile.lock
|
| 97 |
+
|
| 98 |
+
# poetry
|
| 99 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 100 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 101 |
+
# commonly ignored for libraries.
|
| 102 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 103 |
+
#poetry.lock
|
| 104 |
+
|
| 105 |
+
# pdm
|
| 106 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 107 |
+
#pdm.lock
|
| 108 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 109 |
+
# in version control.
|
| 110 |
+
# https://pdm.fming.dev/#use-with-ide
|
| 111 |
+
.pdm.toml
|
| 112 |
+
|
| 113 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 114 |
+
__pypackages__/
|
| 115 |
+
|
| 116 |
+
# Celery stuff
|
| 117 |
+
celerybeat-schedule
|
| 118 |
+
celerybeat.pid
|
| 119 |
+
|
| 120 |
+
# SageMath parsed files
|
| 121 |
+
*.sage.py
|
| 122 |
+
|
| 123 |
+
# Environments
|
| 124 |
+
.env
|
| 125 |
+
.venv
|
| 126 |
+
env/
|
| 127 |
+
venv/
|
| 128 |
+
ENV/
|
| 129 |
+
env.bak/
|
| 130 |
+
venv.bak/
|
| 131 |
+
|
| 132 |
+
# Spyder project settings
|
| 133 |
+
.spyderproject
|
| 134 |
+
.spyproject
|
| 135 |
+
|
| 136 |
+
# Rope project settings
|
| 137 |
+
.ropeproject
|
| 138 |
+
|
| 139 |
+
# mkdocs documentation
|
| 140 |
+
/site
|
| 141 |
+
|
| 142 |
+
# mypy
|
| 143 |
+
.mypy_cache/
|
| 144 |
+
.dmypy.json
|
| 145 |
+
dmypy.json
|
| 146 |
+
|
| 147 |
+
# Pyre type checker
|
| 148 |
+
.pyre/
|
| 149 |
+
|
| 150 |
+
# pytype static type analyzer
|
| 151 |
+
.pytype/
|
| 152 |
+
|
| 153 |
+
# Cython debug symbols
|
| 154 |
+
cython_debug/
|
| 155 |
+
|
| 156 |
+
# PyCharm
|
| 157 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 158 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 159 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 160 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 161 |
+
#.idea/
|
Home.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
from utils import *
|
| 4 |
+
|
| 5 |
+
# #********SIDE BAR*******
|
| 6 |
+
# with st.sidebar:
|
| 7 |
+
# st.sidebar.title("🗝️")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
#Creating session variables
|
| 11 |
+
if 'HR_tickets' not in st.session_state:
|
| 12 |
+
st.session_state['HR_tickets'] =[]
|
| 13 |
+
if 'IT_tickets' not in st.session_state:
|
| 14 |
+
st.session_state['IT_tickets'] =[]
|
| 15 |
+
if 'Transport_tickets' not in st.session_state:
|
| 16 |
+
st.session_state['Transport_tickets'] =[]
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main():
|
| 20 |
+
load_dotenv()
|
| 21 |
+
st.set_page_config(page_title="Ticket Tool", page_icon='🎫')
|
| 22 |
+
|
| 23 |
+
st.header("Automatic Ticket Classification Tool")
|
| 24 |
+
st.write("Please ask your question:")
|
| 25 |
+
user_input = st.text_input("🔍")
|
| 26 |
+
|
| 27 |
+
if user_input:
|
| 28 |
+
#creating embeddings instance...
|
| 29 |
+
embeddings=create_embeddings()
|
| 30 |
+
|
| 31 |
+
#Function to pull index data from Pinecone
|
| 32 |
+
index=pull_from_pinecone("automatic-ticket-tool",embeddings)
|
| 33 |
+
|
| 34 |
+
#This function will help us in fetching the top relevent documents from our vector store - Pinecone Index
|
| 35 |
+
relavant_docs=get_similar_docs(index,user_input)
|
| 36 |
+
|
| 37 |
+
#This will return the fine tuned response by LLM- load_qa_chain
|
| 38 |
+
response=get_answer(relavant_docs,user_input)
|
| 39 |
+
st.write(response)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
#Button to create a ticket with respective department
|
| 43 |
+
button = st.button("Do you want to Submit ticket?")
|
| 44 |
+
|
| 45 |
+
if button:
|
| 46 |
+
#Get Response
|
| 47 |
+
embeddings = create_embeddings()
|
| 48 |
+
query_result = embeddings.embed_query(user_input)
|
| 49 |
+
|
| 50 |
+
#loading the ML model, so that we can use it to predit the class to which this compliant belongs to...
|
| 51 |
+
department_value = predict(query_result)
|
| 52 |
+
st.write("your ticket has been sumbitted to : "+department_value)
|
| 53 |
+
|
| 54 |
+
#Appending the tickets to below list, so that we can view/use them later on...
|
| 55 |
+
if department_value=="HR":
|
| 56 |
+
st.session_state['HR_tickets'].append(user_input)
|
| 57 |
+
elif department_value=="IT":
|
| 58 |
+
st.session_state['IT_tickets'].append(user_input)
|
| 59 |
+
else:
|
| 60 |
+
st.session_state['Transport_tickets'].append(user_input)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if __name__ == '__main__':
|
| 65 |
+
main()
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
Pipfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[[source]]
|
| 2 |
+
url = "https://pypi.org/simple"
|
| 3 |
+
verify_ssl = true
|
| 4 |
+
name = "pypi"
|
| 5 |
+
|
| 6 |
+
[packages]
|
| 7 |
+
openai = "*"
|
| 8 |
+
langchain = "*"
|
| 9 |
+
streamlit = "*"
|
| 10 |
+
python-dotenv = "*"
|
| 11 |
+
langchain-community = "*"
|
| 12 |
+
langchain-openai = "*"
|
| 13 |
+
sentence-transformers = "*"
|
| 14 |
+
tiktoken = "*"
|
| 15 |
+
pinecone-client = "*"
|
| 16 |
+
pandas = "*"
|
| 17 |
+
pypdf = "*"
|
| 18 |
+
joblib = "*"
|
| 19 |
+
scikit-learn = "*"
|
| 20 |
+
|
| 21 |
+
[dev-packages]
|
| 22 |
+
|
| 23 |
+
[requires]
|
| 24 |
+
python_version = "3.10"
|
Pipfile.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
__init__.py
ADDED
|
File without changes
|
app.png
ADDED
|
modelsvm.pk1
ADDED
|
Binary file (375 kB). View file
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
openai
|
| 2 |
+
langchain
|
| 3 |
+
streamlit
|
| 4 |
+
langchain-community
|
| 5 |
+
sentence-transformers
|
| 6 |
+
tiktoken
|
| 7 |
+
python-dotenv
|
| 8 |
+
pinecone-client
|
| 9 |
+
pypdf
|
| 10 |
+
joblib
|
| 11 |
+
pandas
|
| 12 |
+
scikit-learn
|
utils.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pypdf import PdfReader
|
| 2 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 3 |
+
from langchain.embeddings import OpenAIEmbeddings
|
| 4 |
+
from langchain.embeddings.sentence_transformer import SentenceTransformerEmbeddings
|
| 5 |
+
from langchain.llms import OpenAI
|
| 6 |
+
# import pinecone
|
| 7 |
+
from langchain.vectorstores import Pinecone as pc
|
| 8 |
+
import pandas as pd
|
| 9 |
+
from sklearn.model_selection import train_test_split
|
| 10 |
+
from langchain.chains.question_answering import load_qa_chain
|
| 11 |
+
from langchain.callbacks import get_openai_callback
|
| 12 |
+
import joblib
|
| 13 |
+
import os
|
| 14 |
+
# since there have been changes import Pinecone directly from Pinecone and alias above as pc from lc
|
| 15 |
+
from pinecone import Pinecone
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
pinecone_api_key=os.environ["PINECONE_API_KEY"]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
#**********Functions to load data to PINECONE************
|
| 22 |
+
#Read PDF data
|
| 23 |
+
def read_pdf_data(pdf_file):
|
| 24 |
+
pdf_page = PdfReader(pdf_file)
|
| 25 |
+
text = ""
|
| 26 |
+
for page in pdf_page.pages:
|
| 27 |
+
text += page.extract_text()
|
| 28 |
+
return text
|
| 29 |
+
|
| 30 |
+
#Split data into chunks
|
| 31 |
+
def split_data(text):
|
| 32 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=50)
|
| 33 |
+
docs = text_splitter.split_text(text)
|
| 34 |
+
docs_chunks =text_splitter.create_documents(docs)
|
| 35 |
+
return docs_chunks
|
| 36 |
+
|
| 37 |
+
#Create embeddings instance
|
| 38 |
+
def create_embeddings():
|
| 39 |
+
#embeddings = OpenAIEmbeddings()
|
| 40 |
+
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
| 41 |
+
return embeddings
|
| 42 |
+
|
| 43 |
+
#Function to push data to Pinecone
|
| 44 |
+
def push_to_pinecone(pinecone_index_name, embeddings, docs):
|
| 45 |
+
# pineone.init below is no longer supported
|
| 46 |
+
# pinecone.init(
|
| 47 |
+
# api_key=pinecone_api_key,
|
| 48 |
+
# environment=pinecone_environment
|
| 49 |
+
# )
|
| 50 |
+
Pinecone(api_key=pinecone_api_key)
|
| 51 |
+
index_name = pinecone_index_name
|
| 52 |
+
index = pc.from_documents(docs, embeddings, index_name=index_name)
|
| 53 |
+
return index
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
#*********Functions for Model related tasks************
|
| 59 |
+
#Read dataset for model creation - retrun a df
|
| 60 |
+
def read_data(data):
|
| 61 |
+
df = pd.read_csv(data,delimiter=',', header=None)
|
| 62 |
+
return df
|
| 63 |
+
|
| 64 |
+
#Create embeddings instance - fxn above
|
| 65 |
+
#Generating embeddings for our input dataset
|
| 66 |
+
def create_dataset_embeddings(df, embeddings):
|
| 67 |
+
df[2] = df[0].apply(lambda x: embeddings.embed_query(x))
|
| 68 |
+
return df
|
| 69 |
+
|
| 70 |
+
#Splitting the data into train & test
|
| 71 |
+
def split_train_test__data(df_sample):
|
| 72 |
+
# Split into training and testing sets
|
| 73 |
+
sentences_train, sentences_test, labels_train, labels_test = train_test_split(
|
| 74 |
+
list(df_sample[2]), list(df_sample[1]), test_size=0.25, random_state=0)
|
| 75 |
+
print(len(sentences_train))
|
| 76 |
+
return sentences_train, sentences_test, labels_train, labels_test
|
| 77 |
+
|
| 78 |
+
#Get the accuracy score on test data
|
| 79 |
+
def get_score(svm_classifier,sentences_test,labels_test):
|
| 80 |
+
score = svm_classifier.score(sentences_test, labels_test)
|
| 81 |
+
return score
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
#*******UTILs FOR USERS****************
|
| 86 |
+
#Function to pull index data from Pinecone...
|
| 87 |
+
def pull_from_pinecone(pinecone_index_name,embeddings):
|
| 88 |
+
# pinecone.init(
|
| 89 |
+
# api_key=pinecone_apikey,
|
| 90 |
+
# environment=pinecone_environment
|
| 91 |
+
# )
|
| 92 |
+
Pinecone(api_key=pinecone_api_key)
|
| 93 |
+
index_name = pinecone_index_name
|
| 94 |
+
index = pc.from_existing_index(index_name, embeddings)
|
| 95 |
+
return index
|
| 96 |
+
|
| 97 |
+
# def create_embeddings():
|
| 98 |
+
# embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
| 99 |
+
# return embeddings
|
| 100 |
+
|
| 101 |
+
#This function will help us in fetching the top relevent documents from our vector store - Pinecone Index
|
| 102 |
+
def get_similar_docs(index, query,k=2):
|
| 103 |
+
similar_docs = index.similarity_search(query, k=k)
|
| 104 |
+
return similar_docs
|
| 105 |
+
|
| 106 |
+
def get_answer(docs,user_input):
|
| 107 |
+
chain = load_qa_chain(OpenAI(), chain_type="stuff")
|
| 108 |
+
with get_openai_callback() as cb:
|
| 109 |
+
response = chain.run(input_documents=docs, question=user_input)
|
| 110 |
+
return response
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def predict(query_result):
|
| 114 |
+
# load from the model we created
|
| 115 |
+
Fitmodel = joblib.load('modelsvm.pk1')
|
| 116 |
+
result=Fitmodel.predict([query_result])
|
| 117 |
+
return result[0]
|