Spaces:
Running
Running
FauziIsyrinApridal
commited on
Commit
Β·
9fd98bf
1
Parent(s):
8d70ef7
update pengecekan doc kosong
Browse files- app/document_processor.py +1 -10
app/document_processor.py
CHANGED
@@ -27,9 +27,6 @@ def load_vector_store():
|
|
27 |
|
28 |
|
29 |
def process_documents(docs):
|
30 |
-
if not docs:
|
31 |
-
raise ValueError("β Input 'docs' kosong. Tidak ada dokumen untuk diproses.")
|
32 |
-
|
33 |
embeddings = HuggingFaceEmbeddings(
|
34 |
model_name="LazarusNLP/all-indo-e5-small-v4",
|
35 |
model_kwargs={"device": "cpu"},
|
@@ -41,13 +38,7 @@ def process_documents(docs):
|
|
41 |
chunk_overlap=300
|
42 |
)
|
43 |
text_chunks = text_splitter.split_documents(docs)
|
44 |
-
|
45 |
-
if not text_chunks:
|
46 |
-
raise ValueError("β Split dokumen gagal. 'text_chunks' kosong setelah diproses.")
|
47 |
-
|
48 |
-
print(f"β
{len(text_chunks)} text chunks berhasil diproses.")
|
49 |
-
|
50 |
vector_store = FAISS.from_documents(text_chunks, embeddings)
|
|
|
51 |
return vector_store
|
52 |
|
53 |
-
|
|
|
27 |
|
28 |
|
29 |
def process_documents(docs):
|
|
|
|
|
|
|
30 |
embeddings = HuggingFaceEmbeddings(
|
31 |
model_name="LazarusNLP/all-indo-e5-small-v4",
|
32 |
model_kwargs={"device": "cpu"},
|
|
|
38 |
chunk_overlap=300
|
39 |
)
|
40 |
text_chunks = text_splitter.split_documents(docs)
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
vector_store = FAISS.from_documents(text_chunks, embeddings)
|
42 |
+
|
43 |
return vector_store
|
44 |
|
|