Update admin_utils.py
Browse files- admin_utils.py +0 -30
admin_utils.py
CHANGED
@@ -50,33 +50,3 @@ def push_to_pinecone(pinecone_apikey,pinecone_environment,pinecone_index_name,em
|
|
50 |
index_name = pinecone_index_name
|
51 |
index = Pinecone.from_documents(docs, embeddings, index_name=index_name)
|
52 |
return index
|
53 |
-
|
54 |
-
#*********Functions for dealing with Model related tasks...************
|
55 |
-
|
56 |
-
#Read dataset for model creation
|
57 |
-
def read_data(data):
|
58 |
-
df = pd.read_csv(data,delimiter=',', header=None)
|
59 |
-
return df
|
60 |
-
|
61 |
-
#Create embeddings instance
|
62 |
-
def get_embeddings():
|
63 |
-
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
64 |
-
return embeddings
|
65 |
-
|
66 |
-
#Generating embeddings for our input dataset
|
67 |
-
def create_embeddings(df,embeddings):
|
68 |
-
df[2] = df[0].apply(lambda x: embeddings.embed_query(x))
|
69 |
-
return df
|
70 |
-
|
71 |
-
#Splitting the data into train & test
|
72 |
-
def split_train_test__data(df_sample):
|
73 |
-
# Split into training and testing sets
|
74 |
-
sentences_train, sentences_test, labels_train, labels_test = train_test_split(
|
75 |
-
list(df_sample[2]), list(df_sample[1]), test_size=0.25, random_state=0)
|
76 |
-
print(len(sentences_train))
|
77 |
-
return sentences_train, sentences_test, labels_train, labels_test
|
78 |
-
|
79 |
-
#Get the accuracy score on test data
|
80 |
-
def get_score(svm_classifier,sentences_test,labels_test):
|
81 |
-
score = svm_classifier.score(sentences_test, labels_test)
|
82 |
-
return score
|
|
|
50 |
index_name = pinecone_index_name
|
51 |
index = Pinecone.from_documents(docs, embeddings, index_name=index_name)
|
52 |
return index
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|