Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,13 +12,7 @@ from langchain.vectorstores import Chroma
|
|
12 |
|
13 |
from langchain.chains import RetrievalQA
|
14 |
|
15 |
-
global llm
|
16 |
|
17 |
-
def define_llm_model(repo_id):
|
18 |
-
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature":0.1, "max_new_tokens":300})
|
19 |
-
return "LLM model loaded"
|
20 |
-
|
21 |
-
define_llm_model("google/flan-ul2")
|
22 |
|
23 |
def loading_pdf():
|
24 |
return "Loading..."
|
@@ -32,6 +26,7 @@ def pdf_changes(pdf_doc):
|
|
32 |
embeddings = HuggingFaceHubEmbeddings()
|
33 |
db = Chroma.from_documents(texts, embeddings)
|
34 |
retriever = db.as_retriever()
|
|
|
35 |
global qa
|
36 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever, return_source_documents=True)
|
37 |
return "Ready"
|
|
|
12 |
|
13 |
from langchain.chains import RetrievalQA
|
14 |
|
|
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
def loading_pdf():
|
18 |
return "Loading..."
|
|
|
26 |
embeddings = HuggingFaceHubEmbeddings()
|
27 |
db = Chroma.from_documents(texts, embeddings)
|
28 |
retriever = db.as_retriever()
|
29 |
+
llm = HuggingFaceHub(repo_id="google/flan-ul2", model_kwargs={"temperature":0.1, "max_new_tokens":300})
|
30 |
global qa
|
31 |
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever, return_source_documents=True)
|
32 |
return "Ready"
|