Spaces:
Sleeping
Sleeping
Commit
Β·
59308b6
1
Parent(s):
ead8288
Update app.py
Browse files
app.py
CHANGED
@@ -63,6 +63,18 @@ def get_json_file(docs):
|
|
63 |
|
64 |
return text_list
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
|
68 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
|
|
63 |
|
64 |
return text_list
|
65 |
|
66 |
+
def get_vectorstore(text_chunks):
|
67 |
+
# OpenAI μλ² λ© λͺ¨λΈμ λ‘λν©λλ€. (Embedding models - Ada v2)
|
68 |
+
embeddings = OpenAIEmbeddings()
|
69 |
+
|
70 |
+
# Check if there are any text chunks before creating the vector store
|
71 |
+
if not text_chunks:
|
72 |
+
return None
|
73 |
+
|
74 |
+
vectorstore = FAISS.from_documents(text_chunks, embeddings) # FAISS λ²‘ν° μ€ν μ΄λ₯Ό μμ±ν©λλ€.
|
75 |
+
return vectorstore # μμ±λ λ²‘ν° μ€ν μ΄λ₯Ό λ°νν©λλ€.
|
76 |
+
|
77 |
+
|
78 |
|
79 |
|
80 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|