added commets
Browse files- chatbot.py +2 -0
chatbot.py
CHANGED
@@ -18,10 +18,12 @@ def load_models():
|
|
18 |
tokenizer = T5Tokenizer.from_pretrained('t5-small')
|
19 |
generator = T5ForConditionalGeneration.from_pretrained('t5-base').to(device)
|
20 |
return retriever, generator, tokenizer
|
|
|
21 |
|
22 |
retriever, generator, tokenizer = load_models()
|
23 |
|
24 |
def process_query(query):
|
|
|
25 |
# Encode the query into a vector for semantic search using SentenceTransformer
|
26 |
xq = retriever.encode([query]).tolist()
|
27 |
# Query the Pinecone index for the most similar vector to the query
|
|
|
18 |
tokenizer = T5Tokenizer.from_pretrained('t5-small')
|
19 |
generator = T5ForConditionalGeneration.from_pretrained('t5-base').to(device)
|
20 |
return retriever, generator, tokenizer
|
21 |
+
print("Done loading models")
|
22 |
|
23 |
retriever, generator, tokenizer = load_models()
|
24 |
|
25 |
def process_query(query):
|
26 |
+
print("Processing...")
|
27 |
# Encode the query into a vector for semantic search using SentenceTransformer
|
28 |
xq = retriever.encode([query]).tolist()
|
29 |
# Query the Pinecone index for the most similar vector to the query
|