Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def load_vectorstore(model):
|
|
20 |
if 'mpnet' in model:
|
21 |
|
22 |
emb = HuggingFaceEmbeddings(model_name=model)
|
23 |
-
|
24 |
return FAISS.load_local('vanguard-embeddings', emb)
|
25 |
|
26 |
elif 'instructor'in model:
|
@@ -28,6 +28,7 @@ def load_vectorstore(model):
|
|
28 |
emb = HuggingFaceInstructEmbeddings(model_name=model,
|
29 |
query_instruction='Represent the Financial question for retrieving supporting paragraphs: ',
|
30 |
embed_instruction='Represent the Financial paragraph for retrieval: ')
|
|
|
31 |
return FAISS.load_local('vanguard_embeddings_inst', emb)
|
32 |
|
33 |
#default embeddings
|
@@ -109,10 +110,6 @@ class ChatWrapper:
|
|
109 |
|
110 |
chat = ChatWrapper()
|
111 |
|
112 |
-
store_state = gr.State(value=model_options_list[0])
|
113 |
-
|
114 |
-
print(f'var init:{store_state}')
|
115 |
-
|
116 |
block = gr.Blocks(css=".gradio-container {background-color: lightgray}")
|
117 |
|
118 |
with block:
|
@@ -130,11 +127,11 @@ with block:
|
|
130 |
embeddings = gr.Radio(choices=model_options_list,value=model_options_list[0], label='Choose your Embedding Model',
|
131 |
interactive=True)
|
132 |
embeddings.change(on_value_change, embeddings)
|
133 |
-
|
134 |
-
print(embeddings.value)
|
135 |
|
136 |
vectorstore = load_vectorstore(embeddings.value)
|
137 |
|
|
|
|
|
138 |
chatbot = gr.Chatbot()
|
139 |
|
140 |
with gr.Row():
|
|
|
20 |
if 'mpnet' in model:
|
21 |
|
22 |
emb = HuggingFaceEmbeddings(model_name=model)
|
23 |
+
print(emb)
|
24 |
return FAISS.load_local('vanguard-embeddings', emb)
|
25 |
|
26 |
elif 'instructor'in model:
|
|
|
28 |
emb = HuggingFaceInstructEmbeddings(model_name=model,
|
29 |
query_instruction='Represent the Financial question for retrieving supporting paragraphs: ',
|
30 |
embed_instruction='Represent the Financial paragraph for retrieval: ')
|
31 |
+
print(emb)
|
32 |
return FAISS.load_local('vanguard_embeddings_inst', emb)
|
33 |
|
34 |
#default embeddings
|
|
|
110 |
|
111 |
chat = ChatWrapper()
|
112 |
|
|
|
|
|
|
|
|
|
113 |
block = gr.Blocks(css=".gradio-container {background-color: lightgray}")
|
114 |
|
115 |
with block:
|
|
|
127 |
embeddings = gr.Radio(choices=model_options_list,value=model_options_list[0], label='Choose your Embedding Model',
|
128 |
interactive=True)
|
129 |
embeddings.change(on_value_change, embeddings)
|
|
|
|
|
130 |
|
131 |
vectorstore = load_vectorstore(embeddings.value)
|
132 |
|
133 |
+
print(vectorstore)
|
134 |
+
|
135 |
chatbot = gr.Chatbot()
|
136 |
|
137 |
with gr.Row():
|