ryanrwatkins commited on
Commit
73a141a
1 Parent(s): c6eddc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -5,14 +5,21 @@ import csv
5
  import os
6
  import langchain
7
  import chromadb
8
- #import faiss
 
 
 
 
 
 
 
9
 
10
  # Use Chroma in Colab to create vector embeddings, I then saved them to HuggingFace so now I have to set it use them here.
11
- from chromadb.config import Settings
12
- client = chromadb.Client(Settings(
13
- chroma_db_impl="duckdb+parquet",
14
- persist_directory="./embeddings" # Optional, defaults to .chromadb/ in the current directory
15
- ))
16
 
17
 
18
  def get_empty_state():
@@ -143,7 +150,7 @@ with gr.Blocks(css=css) as demo:
143
  btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
144
  input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
145
  btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
146
- prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[description])
147
 
148
 
149
 
 
5
  import os
6
  import langchain
7
  import chromadb
8
+ import glob
9
+
10
+ from langchain.embeddings.openai import OpenAIEmbeddings
11
+ from langchain.vectorstores import Chroma
12
+ from langchain.text_splitter import TokenTextSplitter
13
+ from langchain.llms import OpenAI
14
+ from langchain.chains import ChatVectorDBChain
15
+ from langchain.document_loaders import PyPDFLoader
16
 
17
  # Use Chroma in Colab to create vector embeddings, I then saved them to HuggingFace so now I have to set it use them here.
18
+ #from chromadb.config import Settings
19
+ #client = chromadb.Client(Settings(
20
+ # chroma_db_impl="duckdb+parquet",
21
+ # persist_directory="./embeddings" # Optional, defaults to .chromadb/ in the current directory
22
+ #))
23
 
24
 
25
  def get_empty_state():
 
150
  btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
151
  input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
152
  btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
153
+ prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
154
 
155
 
156