Spaces:
Runtime error
Runtime error
Rename app.py to app1.py
Browse files- app.py → app1.py +3 -3
app.py → app1.py
RENAMED
|
@@ -4,6 +4,7 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
| 4 |
from langchain_core.documents import Document
|
| 5 |
from langchain_huggingface import HuggingFaceEmbeddings
|
| 6 |
from langchain_chroma import Chroma
|
|
|
|
| 7 |
from langchain_community.llms import HuggingFaceHub
|
| 8 |
from langchain.prompts import ChatPromptTemplate
|
| 9 |
from dotenv import load_dotenv
|
|
@@ -27,8 +28,7 @@ status_message = "Инициализация..."
|
|
| 27 |
|
| 28 |
def initialize_chroma():
|
| 29 |
global status_message
|
| 30 |
-
|
| 31 |
-
status_message = "Создание базы данных Chroma..."
|
| 32 |
else:
|
| 33 |
status_message = "База данных Chroma уже существует. Пересоздаем базу данных..."
|
| 34 |
shutil.rmtree(CHROMA_PATH)
|
|
@@ -37,7 +37,7 @@ def initialize_chroma():
|
|
| 37 |
status_message = "База данных Chroma создана и подготовлена."
|
| 38 |
|
| 39 |
embeddings = HuggingFaceEmbeddings(
|
| 40 |
-
model_name="sentence-transformers/paraphrase-multilingual-
|
| 41 |
cache_folder="/tmp/model_cache",
|
| 42 |
model_kwargs={'device': 'cpu'},
|
| 43 |
encode_kwargs={'normalize_embeddings': True}
|
|
|
|
| 4 |
from langchain_core.documents import Document
|
| 5 |
from langchain_huggingface import HuggingFaceEmbeddings
|
| 6 |
from langchain_chroma import Chroma
|
| 7 |
+
from langchain.vectorstores import FAISS
|
| 8 |
from langchain_community.llms import HuggingFaceHub
|
| 9 |
from langchain.prompts import ChatPromptTemplate
|
| 10 |
from dotenv import load_dotenv
|
|
|
|
| 28 |
|
| 29 |
def initialize_chroma():
|
| 30 |
global status_message
|
| 31 |
+
status_message = "Инициализация векторной базы..."
|
|
|
|
| 32 |
else:
|
| 33 |
status_message = "База данных Chroma уже существует. Пересоздаем базу данных..."
|
| 34 |
shutil.rmtree(CHROMA_PATH)
|
|
|
|
| 37 |
status_message = "База данных Chroma создана и подготовлена."
|
| 38 |
|
| 39 |
embeddings = HuggingFaceEmbeddings(
|
| 40 |
+
model_name="sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
|
| 41 |
cache_folder="/tmp/model_cache",
|
| 42 |
model_kwargs={'device': 'cpu'},
|
| 43 |
encode_kwargs={'normalize_embeddings': True}
|