Update app.py
Browse files
app.py
CHANGED
@@ -279,17 +279,11 @@ def get_text_chunks(documents):
|
|
279 |
|
280 |
|
281 |
# ํ
์คํธ ์ฒญํฌ๋ค๋ก๋ถํฐ ๋ฒกํฐ ์คํ ์ด๋ฅผ ์์ฑํ๋ ํจ์์
๋๋ค.
|
282 |
-
def get_vectorstore(text_chunks):
|
283 |
-
if not text_chunks:
|
284 |
-
return None # ๋น text_chunks๋ฅผ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ ์ถ๊ฐํฉ๋๋ค.
|
285 |
|
|
|
286 |
# ์ํ๋ ์๋ฒ ๋ฉ ๋ชจ๋ธ์ ๋ก๋ํฉ๋๋ค.
|
287 |
embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2',
|
288 |
-
model_kwargs={'device': 'cpu'})
|
289 |
-
|
290 |
-
if not embeddings:
|
291 |
-
return None # embeddings๊ฐ ๋น์ด ์๋ ๊ฒฝ์ฐ ์ฒ๋ฆฌ ๋ฐฉ๋ฒ์ ์ถ๊ฐํฉ๋๋ค.
|
292 |
-
|
293 |
vectorstore = FAISS.from_documents(text_chunks, embeddings) # FAISS ๋ฒกํฐ ์คํ ์ด๋ฅผ ์์ฑํฉ๋๋ค.
|
294 |
return vectorstore # ์์ฑ๋ ๋ฒกํฐ ์คํ ์ด๋ฅผ ๋ฐํํฉ๋๋ค.
|
295 |
|
|
|
279 |
|
280 |
|
281 |
# ํ
์คํธ ์ฒญํฌ๋ค๋ก๋ถํฐ ๋ฒกํฐ ์คํ ์ด๋ฅผ ์์ฑํ๋ ํจ์์
๋๋ค.
|
|
|
|
|
|
|
282 |
|
283 |
+
def get_vectorstore(text_chunks):
|
284 |
# ์ํ๋ ์๋ฒ ๋ฉ ๋ชจ๋ธ์ ๋ก๋ํฉ๋๋ค.
|
285 |
embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2',
|
286 |
+
model_kwargs={'device': 'cpu'})
|
|
|
|
|
|
|
|
|
287 |
vectorstore = FAISS.from_documents(text_chunks, embeddings) # FAISS ๋ฒกํฐ ์คํ ์ด๋ฅผ ์์ฑํฉ๋๋ค.
|
288 |
return vectorstore # ์์ฑ๋ ๋ฒกํฐ ์คํ ์ด๋ฅผ ๋ฐํํฉ๋๋ค.
|
289 |
|