Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from typing import List
|
| 2 |
from pathlib import Path
|
| 3 |
-
from
|
| 4 |
from langchain.prompts import ChatPromptTemplate
|
| 5 |
from langchain.schema import StrOutputParser
|
| 6 |
from langchain_community.document_loaders import (
|
|
@@ -19,7 +19,7 @@ import chainlit as cl
|
|
| 19 |
chunk_size = 1024
|
| 20 |
chunk_overlap = 50
|
| 21 |
|
| 22 |
-
embeddings_model =
|
| 23 |
|
| 24 |
PDF_STORAGE_PATH = "./pdfs"
|
| 25 |
|
|
@@ -56,7 +56,7 @@ def process_pdfs(pdf_storage_path: str):
|
|
| 56 |
|
| 57 |
|
| 58 |
doc_search = process_pdfs(PDF_STORAGE_PATH)
|
| 59 |
-
model =
|
| 60 |
|
| 61 |
|
| 62 |
@cl.on_chat_start
|
|
|
|
| 1 |
from typing import List
|
| 2 |
from pathlib import Path
|
| 3 |
+
from langchain_huggingface import ChatHuggingFace, HuggingFaceEmbeddings
|
| 4 |
from langchain.prompts import ChatPromptTemplate
|
| 5 |
from langchain.schema import StrOutputParser
|
| 6 |
from langchain_community.document_loaders import (
|
|
|
|
| 19 |
chunk_size = 1024
|
| 20 |
chunk_overlap = 50
|
| 21 |
|
| 22 |
+
embeddings_model = HuggingFaceEmbeddings()
|
| 23 |
|
| 24 |
PDF_STORAGE_PATH = "./pdfs"
|
| 25 |
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
doc_search = process_pdfs(PDF_STORAGE_PATH)
|
| 59 |
+
model = ChatHuggingFace(model_name="Mixtral-8x7b-Instruct", streaming=True)
|
| 60 |
|
| 61 |
|
| 62 |
@cl.on_chat_start
|