Skip to content

Instantly share code, notes, and snippets.

View vamsigutta's full-sized avatar
🎯
Focusing

Vamsi vamsigutta

🎯
Focusing
View GitHub Profile
@vamsigutta
vamsigutta / semantic_bot.py
Last active July 24, 2023 06:39
This code is can be used to create a basic QA chatbot
from sentence_transformers import SentenceTransformer, util
import torch
if __name__ == "__main__":
questions = ["hi", "What is the product", "what is the cost of the product"]
answers = ["Hi there, How can I help you", "The product is an QA chatbot", "The product is available for free"]
## Load the pretrained model
model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2")
model.max_seq_length = 512
@vamsigutta
vamsigutta / documentbot.py
Created August 18, 2023 14:25
The code helps you query your own personal directory in your pc
from langchain.document_loaders import DirectoryLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import HuggingFaceInstructEmbeddings
from langchain.vectorstores import FAISS
from transformers import T5Tokenizer, T5ForConditionalGeneration
import speech_recognition as sr
import sys
def get_context_faiss(query):
search_results = db.similarity_search(query)