Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 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 |
|