Kshitij-369 commited on
Commit
1bbc695
·
verified ·
1 Parent(s): 70f11de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -12,12 +12,12 @@ from spacy.lang.en import English
12
  from pinecone import Pinecone, ServerlessSpec
13
 
14
  # Retrieve the API keys from environment variables
15
- # COHERE_KEY = os.getenv('COHERE_API_KEY')
16
- # PINECONE_KEY = os.getenv('PINECONE_API_KEY')
17
 
18
  # Initialize global variables
19
- co = cohere.Client('mMJW7g9UDwQCFhtW905hK854aQJPoU13cRevsrvg')
20
- pc = Pinecone(api_key='bdb5ea29-449c-4e3d-8075-a0898d1b8404')
21
  index_name = 'cohere-pinecone'
22
  nlp = English()
23
  nlp.add_pipe("sentencizer")
@@ -45,7 +45,7 @@ def split_list(input_list: list, slice_size: int) -> list[list[str]]:
45
  return [input_list[i:i + slice_size] for i in range(0, len(input_list), slice_size)]
46
 
47
  def process_pdf(pdf_path):
48
- pages_and_texts = open_and_read_pdf(pdf_path=pdf_path, page_offset=41)
49
 
50
  for item in pages_and_texts:
51
  item["sentences"] = [str(sentence) for sentence in nlp(item["text"]).sents]
 
12
  from pinecone import Pinecone, ServerlessSpec
13
 
14
  # Retrieve the API keys from environment variables
15
+ COHERE_KEY = os.getenv('COHERE_API_KEY')
16
+ PINECONE_KEY = os.getenv('PINECONE_API_KEY')
17
 
18
  # Initialize global variables
19
+ co = cohere.Client('COHERE_KEY')
20
+ pc = Pinecone(api_key='PINECONE_KEY')
21
  index_name = 'cohere-pinecone'
22
  nlp = English()
23
  nlp.add_pipe("sentencizer")
 
45
  return [input_list[i:i + slice_size] for i in range(0, len(input_list), slice_size)]
46
 
47
  def process_pdf(pdf_path):
48
+ pages_and_texts = open_and_read_pdf(pdf_path=pdf_path)
49
 
50
  for item in pages_and_texts:
51
  item["sentences"] = [str(sentence) for sentence in nlp(item["text"]).sents]