Update appChatbot.py
Browse files- appChatbot.py +6 -0
appChatbot.py
CHANGED
@@ -6,6 +6,8 @@ import sys
|
|
6 |
import gradio as gr
|
7 |
from huggingface_hub import InferenceClient
|
8 |
|
|
|
|
|
9 |
from langchain.text_splitter import CharacterTextSplitter
|
10 |
from langchain.embeddings import OpenAIEmbeddings
|
11 |
from langchain.vectorstores import Chroma
|
@@ -31,6 +33,10 @@ def replace_newlines_and_spaces(text):
|
|
31 |
def get_documents():
|
32 |
return PyPDFLoader("AI-smart-water-management-systems.pdf").load()
|
33 |
|
|
|
|
|
|
|
|
|
34 |
|
35 |
def init_chromadb():
|
36 |
# Delete existing index directory and recreate the directory
|
|
|
6 |
import gradio as gr
|
7 |
from huggingface_hub import InferenceClient
|
8 |
|
9 |
+
from chromadb.utils import embedding_functions
|
10 |
+
|
11 |
from langchain.text_splitter import CharacterTextSplitter
|
12 |
from langchain.embeddings import OpenAIEmbeddings
|
13 |
from langchain.vectorstores import Chroma
|
|
|
33 |
def get_documents():
|
34 |
return PyPDFLoader("AI-smart-water-management-systems.pdf").load()
|
35 |
|
36 |
+
#def embeddings()
|
37 |
+
embeddings = embedding_functions.SentenceTransformerEmbeddingFunction(
|
38 |
+
model_name="multi-qa-mpnet-base-dot-v1"
|
39 |
+
)
|
40 |
|
41 |
def init_chromadb():
|
42 |
# Delete existing index directory and recreate the directory
|