Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,7 @@ from langchain.vectorstores import FAISS
|
|
6 |
from langchain.chains.question_answering import load_qa_chain
|
7 |
from langchain.llms import HuggingFaceHub
|
8 |
|
9 |
-
|
10 |
-
|
11 |
COUNT, N = 0, 0
|
12 |
chat_history = []
|
13 |
chain = ''
|
@@ -32,7 +31,7 @@ def database():
|
|
32 |
return db
|
33 |
|
34 |
def set_apikey(api_key):
|
35 |
-
os.environ["HUGGINFACEHUB_API_TOKEN"] =
|
36 |
return disable_box
|
37 |
def enable_api_box():
|
38 |
return enable_box
|
@@ -44,7 +43,7 @@ def add_text(history, text):
|
|
44 |
def generate_response(history, query):
|
45 |
global COUNT, N, chat_history, chain
|
46 |
db=database()
|
47 |
-
llm=HuggingFaceHub(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", model_kwargs={"temperature":0.5, "max_length":90},huggingfacehub_api_token=
|
48 |
chain = load_qa_chain(llm, chain_type="refine")
|
49 |
doc = (db.similarity_search_with_score(query))
|
50 |
score=doc[0][-1]
|
|
|
6 |
from langchain.chains.question_answering import load_qa_chain
|
7 |
from langchain.llms import HuggingFaceHub
|
8 |
|
9 |
+
apii=os.environ('spi')
|
|
|
10 |
COUNT, N = 0, 0
|
11 |
chat_history = []
|
12 |
chain = ''
|
|
|
31 |
return db
|
32 |
|
33 |
def set_apikey(api_key):
|
34 |
+
os.environ["HUGGINFACEHUB_API_TOKEN"] = apii
|
35 |
return disable_box
|
36 |
def enable_api_box():
|
37 |
return enable_box
|
|
|
43 |
def generate_response(history, query):
|
44 |
global COUNT, N, chat_history, chain
|
45 |
db=database()
|
46 |
+
llm=HuggingFaceHub(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", model_kwargs={"temperature":0.5, "max_length":90},huggingfacehub_api_token=apii)
|
47 |
chain = load_qa_chain(llm, chain_type="refine")
|
48 |
doc = (db.similarity_search_with_score(query))
|
49 |
score=doc[0][-1]
|