Chandranshu Jain commited on
Commit
1169786
1 Parent(s): befd304

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -13,6 +13,7 @@ from langchain.prompts import PromptTemplate
13
  from langchain_community.document_loaders import PyPDFLoader
14
  from langchain_chroma import Chroma
15
  from langchain_community.vectorstores import Chroma
 
16
 
17
  #st.set_page_config(page_title="Document Genie", layout="wide")
18
 
@@ -60,7 +61,7 @@ def text_splitter(text):
60
 
61
  #GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
62
  #COHERE_API_KEY = os.getenv("COHERE_API_KEY")
63
- HUGGING_FACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
64
 
65
  def get_conversational_chain():
66
  prompt_template = """
@@ -78,8 +79,11 @@ def get_conversational_chain():
78
  #model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.3, google_api_key=GOOGLE_API_KEY)
79
  repo_id ='google/gemma-1.1-2b-it'
80
  #repo_id='meta-llama/Meta-Llama-3-70B'
81
- llm = HuggingFaceEndpoint(
82
- repo_id=repo_id, max_length=512, temperature=0.5, token=HUGGING_FACE_API_KEY)
 
 
 
83
  pt = ChatPromptTemplate.from_template(template)
84
  # Retrieve and generate using the relevant snippets of the blog.
85
  retriever = db.as_retriever()
 
13
  from langchain_community.document_loaders import PyPDFLoader
14
  from langchain_chroma import Chroma
15
  from langchain_community.vectorstores import Chroma
16
+ from transformers import AutoTokenizer, AutoModelForCausalLM
17
 
18
  #st.set_page_config(page_title="Document Genie", layout="wide")
19
 
 
61
 
62
  #GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
63
  #COHERE_API_KEY = os.getenv("COHERE_API_KEY")
64
+ #HUGGING_FACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
65
 
66
  def get_conversational_chain():
67
  prompt_template = """
 
79
  #model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.3, google_api_key=GOOGLE_API_KEY)
80
  repo_id ='google/gemma-1.1-2b-it'
81
  #repo_id='meta-llama/Meta-Llama-3-70B'
82
+ #llm = HuggingFaceEndpoint(
83
+ #repo_id=repo_id, max_length=512, temperature=0.5, token=HUGGING_FACE_API_KEY)
84
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-1.1-2b-it")
85
+ llm = AutoModelForCausalLM.from_pretrained("google/gemma-1.1-2b-it")
86
+
87
  pt = ChatPromptTemplate.from_template(template)
88
  # Retrieve and generate using the relevant snippets of the blog.
89
  retriever = db.as_retriever()