Update app.py
Browse files
app.py
CHANGED
|
@@ -17,11 +17,12 @@ token=""
|
|
| 17 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 18 |
emb = "sentence-transformers/all-mpnet-base-v2"
|
| 19 |
hf = HuggingFaceEmbeddings(model_name=emb)
|
| 20 |
-
db = Chroma()
|
| 21 |
#db.persist()
|
| 22 |
# Load the document, split it into chunks, embed each chunk and load it into the vector store.
|
| 23 |
#raw_documents = TextLoader('state_of_the_union.txt').load()
|
| 24 |
def embed_fn(inp):
|
|
|
|
| 25 |
text_splitter = CharacterTextSplitter(chunk_size=200, chunk_overlap=10)
|
| 26 |
documents = text_splitter.split_text(inp)
|
| 27 |
out_emb= hf.embed_documents(documents)
|
|
@@ -58,6 +59,7 @@ def read_pdf(pdf_path):
|
|
| 58 |
text = f'{text}\n{page.extract_text()}'
|
| 59 |
return text
|
| 60 |
def run_llm(input_text,history):
|
|
|
|
| 61 |
MAX_TOKENS=20000
|
| 62 |
try:
|
| 63 |
qur= hf.embed_query(input_text)
|
|
|
|
| 17 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 18 |
emb = "sentence-transformers/all-mpnet-base-v2"
|
| 19 |
hf = HuggingFaceEmbeddings(model_name=emb)
|
| 20 |
+
#db = Chroma()
|
| 21 |
#db.persist()
|
| 22 |
# Load the document, split it into chunks, embed each chunk and load it into the vector store.
|
| 23 |
#raw_documents = TextLoader('state_of_the_union.txt').load()
|
| 24 |
def embed_fn(inp):
|
| 25 |
+
db=Chroma()
|
| 26 |
text_splitter = CharacterTextSplitter(chunk_size=200, chunk_overlap=10)
|
| 27 |
documents = text_splitter.split_text(inp)
|
| 28 |
out_emb= hf.embed_documents(documents)
|
|
|
|
| 59 |
text = f'{text}\n{page.extract_text()}'
|
| 60 |
return text
|
| 61 |
def run_llm(input_text,history):
|
| 62 |
+
db=Chroma()
|
| 63 |
MAX_TOKENS=20000
|
| 64 |
try:
|
| 65 |
qur= hf.embed_query(input_text)
|