nirmalaag commited on
Commit
fcc64aa
·
verified ·
1 Parent(s): da1379c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -66,18 +66,13 @@ def main():
66
  #PATH = 'model/'
67
  #llm = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-medium")
68
  llm = huggingface_hub.HuggingFaceHub(repo_id="openai-community/gpt2-medium",model_kwargs={"temperature":1.0, "max_length":500})
69
- if query == 'Summarize':
70
- #docs = pdf_reader.load_and_split()
71
- chain = load_summarize_chain(llm, chain_type="map_reduce")
72
- response = chain.run(chunks_doc[0])
73
- else:
74
- docs = vector_store.similarity_search(query=query, k=1)
75
- st.write(docs)
76
- chain = load_qa_chain(llm=llm, chain_type="stuff")
77
- response = chain.run(input_documents=docs, question=query)
78
- #retriever=vector_store.as_retriever()
79
- #chain = RetrievalQA.from_chain_type(llm=llm,chain_type="stuff",retriever=retriever)
80
- #response = chain.run(chain)
81
  st.write(response)
82
 
83
 
 
66
  #PATH = 'model/'
67
  #llm = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-medium")
68
  llm = huggingface_hub.HuggingFaceHub(repo_id="openai-community/gpt2-medium",model_kwargs={"temperature":1.0, "max_length":500})
69
+ docs = vector_store.similarity_search(query=query, k=1)
70
+ st.write(docs)
71
+ #chain = load_qa_chain(llm=llm, chain_type="stuff")
72
+ #response = chain.run(input_documents=docs, question=query)
73
+ retriever=vector_store.as_retriever()
74
+ chain = RetrievalQA.from_chain_type(llm=llm,chain_type="stuff",retriever=retriever)
75
+ response = chain.run(chain)
 
 
 
 
 
76
  st.write(response)
77
 
78