Spaces:
Build error
Build error
Update variables.py
Browse files- variables.py +1 -7
variables.py
CHANGED
@@ -5,7 +5,6 @@ import streamlit as st
|
|
5 |
import pathlib
|
6 |
|
7 |
from langchain.embeddings import HuggingFaceEmbeddings,HuggingFaceInstructEmbeddings
|
8 |
-
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
9 |
from langchain.vectorstores import FAISS
|
10 |
from langchain.chat_models.openai import ChatOpenAI
|
11 |
from langchain import VectorDBQA
|
@@ -72,14 +71,9 @@ def process_tweets(df,df_users):
|
|
72 |
return df_tweets
|
73 |
|
74 |
@st.experimental_singleton(suppress_st_warning=True)
|
75 |
-
def create_vectorstore(
|
76 |
'''Create FAISS vectorstore'''
|
77 |
|
78 |
-
# Split tweets int chunks
|
79 |
-
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
|
80 |
-
texts = text_splitter.split_text(file)
|
81 |
-
|
82 |
-
|
83 |
if model == "hkunlp/instructor-large":
|
84 |
emb = HuggingFaceInstructEmbeddings(model_name=model,
|
85 |
query_instruction='Represent the Financial question for retrieving supporting documents: ',
|
|
|
5 |
import pathlib
|
6 |
|
7 |
from langchain.embeddings import HuggingFaceEmbeddings,HuggingFaceInstructEmbeddings
|
|
|
8 |
from langchain.vectorstores import FAISS
|
9 |
from langchain.chat_models.openai import ChatOpenAI
|
10 |
from langchain import VectorDBQA
|
|
|
71 |
return df_tweets
|
72 |
|
73 |
@st.experimental_singleton(suppress_st_warning=True)
|
74 |
+
def create_vectorstore(texts,model):
|
75 |
'''Create FAISS vectorstore'''
|
76 |
|
|
|
|
|
|
|
|
|
|
|
77 |
if model == "hkunlp/instructor-large":
|
78 |
emb = HuggingFaceInstructEmbeddings(model_name=model,
|
79 |
query_instruction='Represent the Financial question for retrieving supporting documents: ',
|