pankajsingh3012 commited on
Commit
b23206e
·
verified ·
1 Parent(s): 6e4291c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,7 +3,7 @@ import streamlit as st
3
  from PyPDF2 import PdfReader
4
  from langchain.text_splitter import RecursiveCharacterTextSplitter
5
  import os
6
- from langchain_community.embeddings import HuggingFaceEmbeddings
7
  import google.generativeai as genai
8
  from langchain.vectorstores import FAISS
9
  from langchain_google_genai import ChatGoogleGenerativeAI
@@ -40,7 +40,7 @@ def get_text_chunks(text):
40
 
41
  #create embeddings and store in vector database
42
  def get_vector_store(text_chunks):
43
- embeddings = HuggingFaceEmbeddings(model_name="hkunlp/instructor-large")
44
  vector_store = FAISS.from_texts(text_chunks, embedding=embeddings)
45
  vector_store.save_local("faiss_index")
46
 
@@ -67,7 +67,7 @@ def get_conversational_chain():
67
 
68
  #take user input
69
  def user_input(user_question):
70
- embeddings = HuggingFaceEmbeddings(model_name="hkunlp/instructor-large")
71
 
72
  new_db = FAISS.load_local("faiss_index", embeddings)
73
  docs = new_db.similarity_search(user_question)
 
3
  from PyPDF2 import PdfReader
4
  from langchain.text_splitter import RecursiveCharacterTextSplitter
5
  import os
6
+ from langchain_google_genai import GoogleGenerativeAIEmbeddings
7
  import google.generativeai as genai
8
  from langchain.vectorstores import FAISS
9
  from langchain_google_genai import ChatGoogleGenerativeAI
 
40
 
41
  #create embeddings and store in vector database
42
  def get_vector_store(text_chunks):
43
+ embeddings = GoogleGenerativeAIEmbeddings(model = "models/embedding-001")
44
  vector_store = FAISS.from_texts(text_chunks, embedding=embeddings)
45
  vector_store.save_local("faiss_index")
46
 
 
67
 
68
  #take user input
69
  def user_input(user_question):
70
+ embeddings = GoogleGenerativeAIEmbeddings(model = "models/embedding-001")
71
 
72
  new_db = FAISS.load_local("faiss_index", embeddings)
73
  docs = new_db.similarity_search(user_question)