ryanrwatkins commited on
Commit
a17cb7a
·
1 Parent(s): 992f484

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -69,7 +69,7 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
69
  os.environ["OPENAI_API_KEY"] = os.environ['openai_key']
70
 
71
  # load in all the files
72
- path = '/files'
73
  #pdf_files = glob.glob(os.path.join(path, "*.pdf"))
74
  pdf_files = glob.glob(os.path.join(path, "*.pdf"))
75
 
@@ -79,7 +79,7 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
79
  text_splitter = TokenTextSplitter(chunk_size=1000, chunk_overlap=0)
80
  split_pages = text_splitter.split_documents(pages)
81
 
82
- persist_directory = "/embeddings"
83
  embeddings = OpenAIEmbeddings()
84
  vectordb = Chroma.from_documents(split_pages, embeddings, persist_directory=persist_directory)
85
  vectordb.persist()
@@ -123,7 +123,7 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
123
 
124
  # VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=docsearch, return_source_documents=True)
125
  # https://colab.research.google.com/drive/1dzdNDZyofRB0f2KIB4gHXmIza7ehMX30?usp=sharing#scrollTo=b-ejDn_JfpWW
126
-
127
  history.append(prompt_msg)
128
  history.append(completion.message.to_dict())
129
  #history.append(completion.choices[0].message.to_dict())
 
69
  os.environ["OPENAI_API_KEY"] = os.environ['openai_key']
70
 
71
  # load in all the files
72
+ path = './files'
73
  #pdf_files = glob.glob(os.path.join(path, "*.pdf"))
74
  pdf_files = glob.glob(os.path.join(path, "*.pdf"))
75
 
 
79
  text_splitter = TokenTextSplitter(chunk_size=1000, chunk_overlap=0)
80
  split_pages = text_splitter.split_documents(pages)
81
 
82
+ persist_directory = "./embedding"
83
  embeddings = OpenAIEmbeddings()
84
  vectordb = Chroma.from_documents(split_pages, embeddings, persist_directory=persist_directory)
85
  vectordb.persist()
 
123
 
124
  # VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=docsearch, return_source_documents=True)
125
  # https://colab.research.google.com/drive/1dzdNDZyofRB0f2KIB4gHXmIza7ehMX30?usp=sharing#scrollTo=b-ejDn_JfpWW
126
+ history.append("test")
127
  history.append(prompt_msg)
128
  history.append(completion.message.to_dict())
129
  #history.append(completion.choices[0].message.to_dict())