Update functions.py
Browse files- functions.py +3 -3
functions.py
CHANGED
@@ -37,6 +37,7 @@ nltk.download('punkt')
|
|
37 |
|
38 |
from nltk import sent_tokenize
|
39 |
|
|
|
40 |
time_str = time.strftime("%d%m%Y-%H%M%S")
|
41 |
HTML_WRAPPER = """<div style="overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; padding: 1rem;
|
42 |
margin-bottom: 2.5rem">{}</div> """
|
@@ -125,7 +126,7 @@ def process_corpus(corpus, tok, title, embeddings, chunk_size=200, overlap=50):
|
|
125 |
|
126 |
'''Process text for Semantic Search'''
|
127 |
|
128 |
-
pinecone.init(api_key=
|
129 |
|
130 |
tokenizer = tok
|
131 |
text_splitter = CharacterTextSplitter.from_huggingface_tokenizer(tokenizer,chunk_size=chunk_size,chunk_overlap=overlap,separator='. ')
|
@@ -741,5 +742,4 @@ def save_network_html(kb, filename="network.html"):
|
|
741 |
|
742 |
nlp = get_spacy()
|
743 |
|
744 |
-
|
745 |
-
sent_pipe, sum_pipe, ner_pipe, cross_encoder, kg_model, kg_tokenizer, emb_tokenizer = load_models()
|
|
|
37 |
|
38 |
from nltk import sent_tokenize
|
39 |
|
40 |
+
OPEN_AI_KEY = os.environ.get('OPEN_AI_KEY')
|
41 |
time_str = time.strftime("%d%m%Y-%H%M%S")
|
42 |
HTML_WRAPPER = """<div style="overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; padding: 1rem;
|
43 |
margin-bottom: 2.5rem">{}</div> """
|
|
|
126 |
|
127 |
'''Process text for Semantic Search'''
|
128 |
|
129 |
+
pinecone.init(api_key=OPEN_AI_KEY, environment="us-west1-gcp")
|
130 |
|
131 |
tokenizer = tok
|
132 |
text_splitter = CharacterTextSplitter.from_huggingface_tokenizer(tokenizer,chunk_size=chunk_size,chunk_overlap=overlap,separator='. ')
|
|
|
742 |
|
743 |
nlp = get_spacy()
|
744 |
|
745 |
+
sent_pipe, sum_pipe, ner_pipe, cross_encoder, kg_model, kg_tokenizer, emb_tokenizer = load_models()
|
|