Silence1412 commited on
Commit
c6e8c65
·
1 Parent(s): 7299673

Update Chat_with_pdf_LLM.py

Browse files
Files changed (1) hide show
  1. Chat_with_pdf_LLM.py +3 -3
Chat_with_pdf_LLM.py CHANGED
@@ -9,7 +9,7 @@ from langchain.callbacks import get_openai_callback
9
  import os
10
  from streamlit_chat import message
11
 
12
- def LLM_pdf(model = 'google/flan-t5-large'):
13
  # st.header("Ask your PDF 💬")
14
 
15
  # upload file
@@ -45,10 +45,10 @@ def LLM_pdf(model = 'google/flan-t5-large'):
45
  if user_question:
46
  docs = knowledge_base.similarity_search(user_question)
47
 
48
- llm = HuggingFaceHub(repo_id="google/flan-t5-large", model_kwargs={"temperature":5,
49
  "max_length":64})
50
  chain = load_qa_chain(llm, chain_type="stuff")
51
- response = chain.run(input_documents=docs,question=user_question
52
 
53
  #st.write(response)
54
  st.session_state.past.append(user_question)
 
9
  import os
10
  from streamlit_chat import message
11
 
12
+ def LLM_pdf(model_name = 'google/flan-t5-large'):
13
  # st.header("Ask your PDF 💬")
14
 
15
  # upload file
 
45
  if user_question:
46
  docs = knowledge_base.similarity_search(user_question)
47
 
48
+ llm = HuggingFaceHub(repo_id=model_name, model_kwargs={"temperature":5,
49
  "max_length":64})
50
  chain = load_qa_chain(llm, chain_type="stuff")
51
+ response = chain.run(input_documents=docs,question=user_question)
52
 
53
  #st.write(response)
54
  st.session_state.past.append(user_question)